Home > database >  Can query the same expression, the select, put in the where condition is invalid number
Can query the same expression, the select, put in the where condition is invalid number

Time:09-29

Is really to have died by oracle, odd problems always

The SQL statement as follows, BIRTHDAY date type, yyyy - MM - dd
This sentence can be run, not an error:
 SELECT TO_NUMBER (SUBSTR (TO_CHAR (BIRTHDAY), 0, 4)) FROM BO_HT_EM_BASIC_INFO 


This report is invalid number:
 SELECT 1 FROM BO_HT_EM_BASIC_INFO WHERE TO_NUMBER (SUBSTR (TO_CHAR (BIRTHDAY), 0, 4)) & gt; 60 


Indebted heart, according to the novice I understand it, you can select out instructions are legitimate, why in the where clause is invalid, for help under the great god help me to answer

CodePudding user response:

you can select out instructions are legitimate,

You are in PLSQL is query? Should be the first screen data are legitimate, you try on all the data;

CodePudding user response:

reference 1st floor wmxcn2000 response:
you can select out instructions are legitimate,

You are in PLSQL is query? Should be the first screen data are legitimate, you try on all the data;


Is not PLSQL, NAVICATE, directly find out all the data of

CodePudding user response:

The CREATE TABLE AA_BAK
AS

The SELECT TO_NUMBER (SUBSTR (TO_CHAR (BIRTHDAY), 0, 4)) CC FROM BO_HT_EM_BASIC_INFO

See can create success?

CodePudding user response:

refer to the second floor u010588262 response:
Quote: refer to 1st floor wmxcn2000 response:

you can select out instructions are legitimate,

You are in PLSQL is query? Should be the first screen data are legitimate, you try on all the data;


Is not PLSQL, NAVICATE, directly find out all the data of


Your statement can create table success
And I found similar to the following this statement also cannot perform success
 SELECT BIRTHDAY FROM (
The SELECT BIRTHDAY, TO_NUMBER (SUBSTR (TO_CHAR (BIRTHDAY), 6, 2)) AS the MM FROM BO_HT_EM_BASIC_INFO WHERE RETIREMENT_NUM IS NULL)
WHERE the MM & lt; 1 the OR MM> 12


Subquery can be successful, but after coated with a layer and the TO_NUMBER field to do queries, or newspaper ORA - 01722: invalid number,

The database version:

CodePudding user response:

The
reference 3 floor wmxcn2000 response:
CREATE TABLE AA_BAK
AS

The SELECT TO_NUMBER (SUBSTR (TO_CHAR (BIRTHDAY), 0, 4)) CC FROM BO_HT_EM_BASIC_INFO

See can create success?
just reply reference is wrong, you see the above reply

CodePudding user response:

The
reference 3 floor wmxcn2000 response:
CREATE TABLE AA_BAK
AS

The SELECT TO_NUMBER (SUBSTR (TO_CHAR (BIRTHDAY), 0, 4)) CC FROM BO_HT_EM_BASIC_INFO

See can create success?


Find a similar, a little understand what he said, but don't know how to solve,,,
http://413486774.iteye.com/blog/1409294

CodePudding user response:

The
refer to the original poster u010588262 response:
SQL statement as follows, BIRTHDAY date type, yyyy - MM - dd
This sentence can be run, not an error:
 SELECT TO_NUMBER (SUBSTR (TO_CHAR (BIRTHDAY), 0, 4)) FROM BO_HT_EM_BASIC_INFO 


This report is invalid number:
 SELECT 1 FROM BO_HT_EM_BASIC_INFO WHERE TO_NUMBER (SUBSTR (TO_CHAR (BIRTHDAY), 0, 4)) & gt; 60 


WHERE else conditions?
  • Related