Return number from Oracle Select statement after parsing date(解析日期后从 Oracle Select 语句返回编号)
问题描述
我想编写一个 Oracle SQL select 语句,通过返回代码来判断它是否可以解析给定格式的日期字符串 - 失败时为零(异常),成功时返回正数:
I want to write a Oracle SQL select statement that tells if it could parse a date string in the given format by returning a code - zero on failure (exception) and a positive number in case of success :
我该怎么写?如果解析失败,ELSE 条件会返回一个值吗?我需要在 SELECT 语句本身中进行所有这些检查.请帮忙.
How do I write this ? If the parsing fails, will the ELSE condition return a value ? I need to do all these checks in the SELECT statement itself. Please help.
谢谢忧郁
推荐答案
如果您可以创建一个函数,那么您可以执行以下操作:
If you can create a function then you can do something like:
SQL 小提琴
Oracle 11g R2 架构设置:
查询 1:
结果:
这篇关于解析日期后从 Oracle Select 语句返回编号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!