Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Why this "ORA-01722: invalid number" error ?

T.BoydOct 18 2017 — edited Oct 18 2017

DB version: 11.2.0.4

Query1 runs fine. In Query2 , I just want the values to be separated using the pipe operator ( '|' ) .

But Query2 errors out with "ORA-01722: invalid number" . When I enclose the CREATED+1/3 column in parenthesis, the issue is fixed.

What is the root cause of this issue?

--Query1

select

X_ORDER_SUB_TYPE ,

CREATED+1/3

from SIEBEL.S_ORDER

WHERE ROWNUM < 5;

X_ORDER_SUB_TYPE                    CREATED+1

----------------------------------- ---------

Change SIM                          19-SEP-17

Change SIM                          19-SEP-17

New Registration                    19-SEP-17

Change Rate Plan                    19-SEP-17

--- Query2

SQL> select

        X_ORDER_SUB_TYPE || '|' ||

        CREATED+1/3

from SIEBEL.S_ORDER

WHERE ROWNUM < 5;  2    3    4    5

      

       X_ORDER_SUB_TYPE || '|' ||

                                 *

ERROR at line 2:

ORA-01722: invalid number

--- Fix : Enclose the CREATED+1/3 column in paranthesis

select

X_ORDER_SUB_TYPE || '|' || (CREATED+1/3)

from SIEBEL.S_ORDER

WHERE ROWNUM < 5;

X_ORDER_SUB_TYPE||'|'||(CREATED+1/3)

--------------------------------------------------------------------------------

Change SIM|19-SEP-17

Change SIM|19-SEP-17

New Registration|19-SEP-17

Change Rate Plan|19-SEP-17

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 15 2017
Added on Oct 18 2017
10 comments
1,391 views