RE: Force implicit data conversion - REOPENED

  • From: Michael Rosenblum <mrosenblum@xxxxxxxxxxx>
  • To: Michael Rosenblum <mrosenblum@xxxxxxxxxxx>, Sayan Malakshinov <xt.and.r@xxxxxxxxx>
  • Date: Mon, 23 Mar 2015 20:17:45 +0000

Sorry, mistyped. The question should read:

The error clearly suggests that Oracle is applying TO_NUMBER to OBJECT_NAME 
(Case #1), but for the Case #2 doesn’t apply TO_CHAR to OBJECT_ID.


From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx] On 
Behalf Of Michael Rosenblum
Sent: Monday, March 23, 2015 4:12 PM
To: Sayan Malakshinov
Cc: Oracle-L Freelists
Subject: RE: Force implicit data conversion - REOPENED

Well, not exactly (IMHO). If implicit datatype conversion is the explanation, 
than why does first PL/SQL block fails, while the second succeeds?

SQL> declare
  2      v_nr number;
  3  begin
  4      select /*+ gather_plan_statistics misha119 */ count(*) into v_nr
  5      from misha_bind where object_name=100;
  6  end;
  7  /
declare
*
ERROR at line 1:
ORA-01722: invalid number
ORA-06512: at line 4


SQL> declare
  2      v_nr number;
  3  begin
  4      select /*+ gather_plan_statistics misha120 */ count(*) into v_nr
  5      from misha_bind where object_id='100';
  6  end;
  7  /

PL/SQL procedure successfully completed.

SQL>

The error clearly suggests that Oracle is applying TO_NUMBER to OBJECT_NAME 
(Case #2), but for the Case #1 doesn’t apply TO_CHAR to OBJECT_ID.

Still puzzled,
Michael


From: Sayan Malakshinov [mailto:xt.and.r@xxxxxxxxx]
Sent: Monday, March 23, 2015 1:55 PM
To: Michael Rosenblum
Cc: Oracle-L Freelists
Subject: Re: Force implicit data conversion - REOPENED

Michael,

This is well described in the documentation: 
https://docs.oracle.com/cd/E11882_01/server.112/e41084/sql_elements002.htm#SQLRF00214

--
Best regards,
Sayan Malakshinov
Oracle ACE Associate
http://orasql.org

Other related posts: