I'm getting "ORA-00900: invalid SQL statement" error. ?

I installed oracle 11 GR 2. and 'DBMS_METADATA_DIFF.COMPARE_ALTER ('TABLE', 'TBL_A', 'TBL_A','USER1 ','USER2 ')"to see the result as below, but I'm" ORA-00900: invalid SQL statement "error.   Any idea?



I use:


Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

PL/SQL Release 11.2.0.1.0 - Production

CORE 11.2.0.1.0 Production

AMT for 32-bit Windows: Version 11.2.0.1.0 - Production

NLSRTL Version 11.2.0.1.0 - Production




SQL > desc user1.tbl_a
Name                                      Null?    Type
----------------------------------------- -------- ----------------------------
FIELD_A1 NOT NULL NUMBER
FIELD_A2 VARCHAR2 (20)
FIELD_A4 NOT NULL NUMBER (5.2)
FIELD_A5 VARCHAR2 (10)
FIELD_A6 NOT NULL NUMBER (2)

SQL > desc user2.tbl_a
Name                                      Null?    Type
----------------------------------------- -------- ----------------------------
FIELD_A1 NOT NULL NUMBER
FIELD_A2 VARCHAR2 (50)
FIELD_A3                                           DATE
FIELD_A4 NUMBER (5.2)
FIELD_A5 NOT NULL VARCHAR2 (10)




SQL > select dbms_metadata_diff.compare_alter ('TABLE', 'TBL_A', 'TBL_A', 'USER1', 'USER2') of double

expected result:

DBMS_METADATA_DIFF.COMPARE_ALTER ('TABLE', 'TBL_A', 'TBL_A', 'U1', 'U2')
--------------------------------------------------------------------------------
ALTER TABLE 'U1 '. "" ADD TBL_A "(DATE OF THE"FIELD_A3")
ALTER TABLE 'U1 '. "" TBL_A "DROP ("FIELD_A6")
ALTER TABLE 'U1 '. "" CHANGE TBL_A ' ("FIELD_A2' VARCHAR2 (50))
ALTER TABLE 'U1 '. "" TBL_A ' CHANGE ("FIELD_A4" NUMBER (5.2) DEFAULT 0)
ALTER TABLE 'U1 '. "" CHANGE TBL_A ' ('FIELD_A4' NULL)
ALTER TABLE 'U1 '. "" CHANGE TBL_A ' ('FIELD_A5' ACTIVATE NOT NULL)

Thanks for the reply rp,

I got the result using "select dbms_metadata_diff.compare_alter ('TABLE', 'TBL_A', 'TBL_A', 'USER1', 'USER2') from dual"

Tags: Database

Similar Questions

  • error SQL ORA-00900: invalid SQL statement

    Hi all

    I'm new to sql and I'm trying to solve this problem, I have here.

    When I run this query (1) I get this message: ORA-00900: invalid SQL statement

    Query: 1


    WITH t1
    AS (SELECT CID,
    TYPE,
    TO_CHAR)
    TO_DATE (' 00:00:00 ', 'HH24:MI:SS')
    + (lg_end_time - lg_start_time).
    Call_time 'HH24:MI:SS'),
    ROW_NUMBER)
    COURSES (SORTING CID CID NULLS FIRST PARTITION)
    AS call_id1
    OF test_1
    )
    SELECT SUM (call_time)
    FROM t1;
    output:
    I get the error: ORA-01722: invalid number




    table structure:

    Select * form test_1;

    CID TYPE LG_END_TIME LG_START_TIME
    1508643 expedition 2012/12/03 14:05 2012/12/03 14:02
    1508643 treatment 2012/12/03 14:00 03/12/2012 14:00
    1508643 initiation 2012/12/03 14:00 03/12/2012 14:00
    1508662 expedition 2012/12/03 14:18 2012/12/03 14:16
    1508662 initiation 2012/12/03 14:01 03/12/2012 14:01
    1508662 treatment 2012/12/03 14:02 03/12/2012 14:01
    1508643 expedition 2012/12/03 14:02 03/12/2012 14:00
    1508662 expedition 2012/12/03 14:16 2012/12/03 14:02

    Thanks for your help

    I think this example might help.

    SQL> select decode(call_id1,99,null,cid)        cid,
      2         decode(call_id1,99,null,type)       type,
      3         decode(call_id1,99,null,to_char(call_time,'hh24:mi:ss'))  call_time,
      4         decode(call_id1,99,null,substr(call_id1,1,5))   call_id1,
      5         total_time
      6    from (select cid,
      7                 type,
      8                 call_time,
      9                 call_id1,
     10                 total_time
     11            from (select cid,
     12                         type,
     13                         call_time,
     14                         call_id1,
     15                         null total_time
     16                    from (SELECT CID ,
     17                                 TYPE,
     18                                 to_date(TO_CHAR (TO_DATE ('00:00:00', 'HH24:MI:SS') +
     19                                        (lg_end_time - lg_start_time),'HH24:MI:SS'),'HH24:MI:SS') call_time,
     20                                 ROW_NUMBER () OVER (PARTITION BY CID ORDER BY CID NULLS FIRST) AS call_id1
     21                            FROM test_1 ) t1
     22                  union all
     23                  select cid,
     24                         null type,
     25                         null call_time,
     26                         99   call_id1,
     27                         lpad(hours,2,'0')||':'||lpad(minutes,2,'0')||':'||lpad(seconds,2,'0') total_time
     28                    from (select cid,
     29                                 sum(to_number(to_char(call_time,'hh24'))) +
     30                                     trunc((sum(to_number(to_char(call_time,'mi'))) +
     31                                     (trunc(sum(to_number(to_char(call_time,'ss')))/60)))/24) hours,
     32                                 sum(to_number(to_char(call_time,'mi'))) +
     33                                    (trunc(sum(to_number(to_char(call_time,'ss')))/60)) minutes,
     34                                 (sum(to_number(to_char(call_time,'ss'))) -
     35                                     ((trunc(sum(to_number(to_char(call_time,'ss')))/60)) * 60)) seconds
     36                            from (SELECT CID ,
     37                                         TYPE,
     38                                         to_date(TO_CHAR (TO_DATE ('00:00:00', 'HH24:MI:SS') +
     39                                                (lg_end_time - lg_start_time),'HH24:MI:SS'),'HH24:MI:SS') call_time,
     40                                         ROW_NUMBER () OVER (PARTITION BY CID ORDER BY CID NULLS FIRST) AS call_id1
     41                                    FROM test_1 ) t1
     42                          group by cid) )
     43          order by cid, call_id1 );
    
    CID                                      TYPE                 CALL_TIME CALL_ID1 TOTAL_TIME
    ---------------------------------------- -------------------- --------- -------- ----------
    1508643                                  Dispatching          00:02:06  1
    1508643                                  Initiation           00:00:00  2
    1508643                                  Treatment            00:00:39  3
    1508643                                  Dispatching          00:02:50  4
                                                                                     00:05:35
    1508662                                  Treatment            00:01:03  1
    1508662                                  Initiation           00:00:00  2
    1508662                                  Dispatching          00:13:17  3
    1508662                                  Dispatching          00:02:43  4
                                                                                     00:17:03
    
    10 rows selected
    
    SQL> 
    
  • to DECLARE * ERROR at line 1: ORA-00900: invalid SQL statement

    This works fine when I use the System user to create a schema and then run this script.
    When I create another user with grant connect, resources, create view permissions I get this error:

    DECLARE
    *

    ERROR on line 1:
    ORA-00900: invalid SQL statement
    ORA-06512: at...


    DECLARE
    ID MY_TABLE.ID%TYPE;
    tNom my_table. % TABLENAME TYPE;
    PName MY_TABLE_TWO. PROPERTYNAME % TYPE;
    CURSOR c1 IS
    SELECT distinct evt.id, evt. TABLENAME, vid.propertyname
    FROM my_table evt, vid MY_TABLE_TWO
    WHERE the evt. COL_1 = 1
    AND evt. COL_2 = vid. COL_2
    and not exists (select facts FROM MY_TABLE_THREE 1)
    where evt.id = facts.eventid and facts.displayname = vid.propertyname);
    BEGIN
    OPEN c1;
    LOOP
    FETCH c1 INTO id, tNom, pname;
    OUTPUT WHEN c1% NOTFOUND;
    INSERT INTO MY_TABLE_THREE (ID, COLUMNLENGTH)
    VALUES (S_ANALYTICS_SEQUENCE.nextval, 255);
    RUN IMMEDIATELY 'ALTER TABLE ' | tNom | 'Add ' | PName | ' _ NVARCHAR2 (255);
    END LOOP;
    CLOSE c1;
    END;

    Hello

    Maybe missing a privilege. If I were you, I'll try this first:

    DECLARE
       id    MY_TABLE.ID%TYPE;
       tname MY_TABLE.TABLENAME%TYPE;
       pname MY_TABLE_TWO.PROPERTYNAME%TYPE;
       CURSOR c1 IS
          SELECT DISTINCT evt.id,
                          evt.TABLENAME,
                          vid.propertyname
            FROM MY_TABLE     evt,
                 MY_TABLE_TWO vid
           WHERE evt.COL_1 = 1
             AND evt.COL_2 = vid.COL_2
             AND NOT EXISTS (SELECT 1
                    FROM MY_TABLE_THREE facts
                   WHERE evt.id = facts.eventid
                     AND facts.displayname = vid.propertyname);
    BEGIN
       OPEN c1;
       LOOP
          FETCH c1
             INTO id, tname, pname;
          EXIT WHEN c1%NOTFOUND;
          INSERT INTO MY_TABLE_THREE
             (ID,
              COLUMNLENGTH)
          VALUES
             (S_ANALYTICS_SEQUENCE.NEXTVAL,
              255);
          DBMS_OUTPUT.put_line('ALTER TABLE ' || tname || ' add ' || pname ||
                               '_ NVARCHAR2(255)');
          --EXECUTE IMMEDIATE 'ALTER TABLE ' || tname || ' add ' || pname || '_ NVARCHAR2(255)';
       END LOOP;
       CLOSE c1;
    EXCEPTION
       WHEN OTHERS THEN
          DBMS_OUTPUT.put_line(SQLERRM);
    END;
    /
    

    Using this approach, you can see the sentences to run without run, I also added an exception block.

    Kind regards

  • 00900 invalid SQL statement error

    I am myself to write stored procedures, teacher in TOAD 10.5 with Oracle 10 g. I get the error ORA-00900: invalid SQL statement. Here's the code, cut to the minimum sample size strip. I don't see where I'm doing something wrong.

    If I cut out the slider (take it down to just "Begin" and "End"), it runs, but I don't see anything wrong with the cursor.

    Any ideas?

    CREATE OR REPLACE PROCEDURE IN_PROCESS_CASES_BOS
    IS
    V_HELLO VARCHAR2 (10);

    CURSOR C_MAIN IS
    SELECT 'HELLO' FROM DUAL;

    BEGIN

    C_MAIN OPEN;

    LOOP
    EXTRACT THE C_MAIN IN V_HELLO;

    WHEN THE OUTPUT C_MAIN % NOTFOUND;

    END LOOP;

    CLOSE C_MAIN;
    END;
    END IN_PROCESS_CASES_BOS;
    /
    select * from user_errors;
    
    NAME                           TYPE           SEQUENCE       LINE   POSITION
    ------------------------------ ------------ ---------- ---------- ----------
    TEXT
    --------------------------------------------------------------------------------
    ATTRIBUTE MESSAGE_NUMBER
    --------- --------------
    IN_PROCESS_CASES_BOS           PROCEDURE             1         21          1
    PLS-00103: Encountered the symbol "END"
    ERROR                103
    

    You have an extra END; Remove it and the procedure compiles and runs.

  • ORA-00900 invalid SQL statement

    Hello

    I'm under code below

    Start

    for c_masteraccntfirmcustid in (select regexp_substr (substr (substr ("AND WB0. MASTERACCNTFIRMCUSTID (742254777, 2531215, 2568091)', instr ("AND WB0. MASTERACCNTFIRMCUSTID in (742254777, 2531215, 2568091) ',' (()) + 1), length 0, (substr ("AND WB0. MASTERACCNTFIRMCUSTID (742254777, 2531215, 2568091)', instr ("AND WB0. MASTERACCNTFIRMCUSTID in (742254777, 2531215, 2568091) ',' (()) + 1))-1), "[^,] (+', 1, level) col_val of the double connection by regexp_substr (substr (substr ("AND WB0. " MASTERACCNTFIRMCUSTID (742254777, 2531215, 2568091)', instr ("AND WB0. MASTERACCNTFIRMCUSTID in (742254777, 2531215, 2568091) ',' (()) + 1), length 0, (substr ("AND WB0. MASTERACCNTFIRMCUSTID (742254777, 2531215, 2568091)', instr ("AND WB0. MASTERACCNTFIRMCUSTID in (742254777, 2531215, 2568091) ',' (()) + 1))-1), "[^,] (+', 1, level) is not null)"

    loop
    dbms_output.put_line (c_masteraccntfirmcustid.col_val);
    -dbms_output.put_line ('Hi');
    end loop;
    end;

    This gives me the Ora-900

    but under work

    Select regexp_substr (substr (substr ("AND WB0. MASTERACCNTFIRMCUSTID (742254777, 2531215, 2568091)', instr ("AND WB0. MASTERACCNTFIRMCUSTID in (742254777, 2531215, 2568091) ',' (()) + 1), length 0, (substr ("AND WB0. MASTERACCNTFIRMCUSTID (742254777, 2531215, 2568091)', instr ("AND WB0. MASTERACCNTFIRMCUSTID in (742254777, 2531215, 2568091) ',' (()) + 1))-1), "[^,] (+', 1, level) col_val of the double connection by regexp_substr (substr (substr ("AND WB0. " MASTERACCNTFIRMCUSTID (742254777, 2531215, 2568091)', instr ("AND WB0. MASTERACCNTFIRMCUSTID in (742254777, 2531215, 2568091) ',' (()) + 1), length 0, (substr ("AND WB0. MASTERACCNTFIRMCUSTID (742254777, 2531215, 2568091)', instr ("AND WB0. MASTERACCNTFIRMCUSTID in (742254777, 2531215, 2568091) ',' (()) + 1))-1), "[^,] (+', 1, level) is not null"

    The requirement is AND WB0. MASTERACCNTFIRMCUSTID (742254777, 2531215, 2568091), this string I need

    742254777

    2531215

    2568091

    one by one and then I'll create a dynamic SQL for each of these values.

    Could you please help?

    Thank you

    Patricia

    I have run your PL/SQL block, but do not make a mistake.

    What is your version of the database?

    BEGIN
      FOR c_masteraccntfirmcustid                                                                                                                                                    IN
      (SELECT regexp_substr(SUBSTR(SUBSTR('AND WB0.MASTERACCNTFIRMCUSTID in (742254777, 2531215, 2568091)',
             instr('AND WB0.MASTERACCNTFIRMCUSTID in (742254777, 2531215, 2568091)','(')+1), 0, LENGTH(SUBSTR('AND WB0.MASTERACCNTFIRMCUSTID in (742254777, 2531215, 2568091)',
             instr('AND WB0.MASTERACCNTFIRMCUSTID in (742254777, 2531215, 2568091)','(')+1))-1),'[^,]+', 1, level) col_val
      FROM dual
        CONNECT BY regexp_substr(SUBSTR(SUBSTR('AND WB0.MASTERACCNTFIRMCUSTID in (742254777, 2531215, 2568091)',instr('AND WB0.MASTERACCNTFIRMCUSTID in (742254777, 2531215, 2568091)','(')+1), 0,
        LENGTH(SUBSTR('AND WB0.MASTERACCNTFIRMCUSTID in (742254777, 2531215, 2568091)',instr('AND WB0.MASTERACCNTFIRMCUSTID in (742254777, 2531215, 2568091)','(')+1))-1), '[^,]+', 1, level) IS NOT NULL
      )
      LOOP
        dbms_output.put_line(c_masteraccntfirmcustid.col_val);
        --dbms_output.put_line('Hi');
      END LOOP;
    END;
    
  • ORA-00900: the SQL statement invalid when you run for immediate assistance.

    Hello
    I write code simple db is 9.2.0.8
    create or replace procedure gather_part_stats(p_schema in varchar2, p_table in varchar2)
    as
    l_quarter varchar2(8) := to_char(sysdate, '"Y"YYYY"_Q"q') ;
    l_sql varchar2(2000) := 'exec dbms_stats.gather_table_stats(:schema, :table, method_opt => ''for all columns size 1'' , cascade => true , estimate_percent => 1 , granularity => ''PARTITION'', partname=>:part);';
    begin
    dbms_output.put_line('l_quarter: ' || l_quarter);
    dbms_output.put_line(l_sql);
    execute immediate l_sql using in p_schema, in p_table, in l_quarter ;
    end;
    /
    Trying to collect statistics of the table with the selected partition but mess up something with... something :)
    I use use to avoid sql injection, please advice.

    Error is:
    SQL > gather_part_stats exec ('TEST', 'TEST');
    l_quarter: Y2012_Q2
    exec dbms_stats.gather_table_stats (: schema,: table, method_opt = > ' for all columns size 1', cascade = > true, estimate_percent = > 1, granularity = > 'PARTITION', partname = >: part);
    BEGIN gather_part_stats ('TEST', 'TEST'); END;

    *
    ERROR on line 1:
    ORA-00900: invalid SQL statement
    ORA-06512: at the 'INSTALL '. GATHER_PART_STATS', line 8
    ORA-06512: at line 1

    Concerning
    GregG

    You must use the dynamic PL/SQL

    create or replace procedure gather_part_stats(p_schema in varchar2, p_table in varchar2)
    as
    l_quarter varchar2(8) := to_char(sysdate, '"Y"YYYY"_Q"q') ;
    l_sql varchar2(2000) := 'begin dbms_stats.gather_table_stats(ownname=>:schema, tabname=>:table, method_opt => ''for all columns size 1'' , cascade => true , estimate_percent => 1 , granularity => ''PARTITION'', partname=>:part); end;';
    begin
    dbms_output.put_line('l_quarter: ' || l_quarter);
    dbms_output.put_line(l_sql);
    execute immediate l_sql using in p_schema, in p_table, in l_quarter ;
    end;
    / 
    
  • ORA-00900: invalid SQL ORA-06512 statement: on line 57

    I Wast trying to execute this statement

    EXECUTE immediate ' host (mkdir'| direcotry |') ' ;
    My destination path directory. I can't run a host command in plsql

    assuming that your database is installed on the windows platform and you try to create the directory is on the same server. try to create a batch file that takes parameters and use the DBMS_SCHEDULER to run an external command.

    Batch file name make.bat

    @echo off
    mkdir %1
    

    your pl/sql script

    BEGIN
      dbms_scheduler.create_job(job_name   => 'AUTO_CREATE_DIRECTORY',
                                job_type   => 'EXECUTABLE',
                                job_action => 'c:\myscript\make.bat',
                                number_of_arguments => 1,
                                start_date => SYSTIMESTAMP,
                                enabled    => FALSE,
                                comments   => 'Auto Create Directory');
    
      dbms_scheduler.set_job_argument_value('AUTO_CREATE_DIRECTORY', 1, argument_value=> 'mydir');
      dbms_scheduler.enable('AUTO_CREATE_DIRECTORY');
    END;
    /
    

    Note: not tested

  • Getting ORA-01017: invalid username/password error only with specific tools

    Hello
    I'm still a Junior DBA familiar with Oracle. I have difficulties to access one of my databases with tools of TOAD and SQLDetective. When I try to connect to my database using these tools, I get the error:

    ORA - 01017: name of user and password invalid. connection refused

    Even if the password and user name is correct.

    I can correctly connect through other tools like SQLTools and sqlplus. I searched on this problem and I've seen people with the same problems, but I could not find a solution. The strange thing is, I can use TOAD and SQLDetective to connect to other databases with no problems. It seems to be present a specific database.

    My database is a database 11g on linux machine. I have clients 9i and 10 g installed on my machine. All my applications use the 9i on my machine home tnsnames.

    Any help on this would be greatly appreciated. Thank you.

    RGS,
    Rob

    Published by: rgilligan on April 16, 2010 02:11

    Hello, if it is 11g, look at the sec_case_sensitive_logon parameter. This default is true, which makes the case-sensitive password. Some tools/applications do a HIGHER or LOWER on the password and so what can the reason for the error

    Henner

  • ORA-00900 - the SQL commands: invalid SQL statement

    Hello world
    I installed Oracle Xe on a Centos 5.5 host yesteday.
    Installation was Ok, I can connect to the web interface on "http://127.0.0.1:8080 / apex / '.
    But when I want to use sql commands, regardless of the input control, I have the "ORA-00900: invalid SQL statement" message.
    I can enter the command "Show all", for example, in a terminal after SQL > command prompt, it works... but not in the web interface...
    I tried to import the .sql, script trought the web interface, no much result, no display in the window.
    Can someone help me,
    Thank you

    Show all is NOT a SQL command is a command that I think, not a command from pl/sql, sql more... Why not try to do a select on a table is know YOU the schema...

    Thank you

    Tony Miller
    Webster, TX

  • Invalid SQl statement

    I am getting error - ORA-00900: invalid SQL statement when executing the following statement:
    SELECT * FROM CUSTOMER
    Sanjay

    Have you looked at the suggestions of fanny?
    You can try selecting ANY table in a DIFFERENT pattern?

    You have not provided your version of DB, try and throw more light on the issue, otherwise its going to be the exercise trail and error.

  • Getting Ora-06502: PL/SQL of Numeric or value error.

    Hello

    I m getting the following error when a calculation for form fields.

    ""Server Ajax Call returned error Ora-06502: PL/SQL digital error or value ".

    I m using the dynamic action to calculate my value fields display. Here is the code of my DA.

    (Required value) event: change

    Selection type (required): product (s)

    Article (s) (required): P141_PROP_COST, P141_DOWNPAY_AMT, P141_PREM_PERC, P141_DOWNPAY_PERC, P141_PREM_AMT



    Begin

    : P141_TOTAL_SELL_PRICE: =: P141_DOWNPAY_AMT +: P141_PREM_AMT;

    : P141_COMM_AMT: =: P141_TOTAL_SELL_PRICE*.02;

    : P141_TOTAL_SELL_PRICE_FEE: =: P141_TOTAL_SELL_PRICE +: P141_TRANSFER_COST +: P141_COMM_AMt;

    : P141_INST_REM_AMT: =: P141_PROP_COST-: P141_DOWNPAY_AMT;

    End;

    Page point to presented: P141_PROP_COST, P141_DOWNPAY_AMT, P141_PREM_AMT, P141_TRANSFER_COST

    Return point page: P141_TOTAL_SELL_PRICE, P141_COMM_AMT, P141_TOTAL_SELL_PRICE_FEE, P141_INST_REM_AMT

    I m using another DA for the calculation and validation of my form fields rest. Here is the code:

    {$("#P141_DOWNPAY_PERC").change (function ()}

    var x = ($("#P141_DOWNPAY_PERC").val () / 100) * $("#P141_PROP_COST").val ();

    $("#P141_DOWNPAY_AMT").val (x);

    });

    {$("#P141_DOWNPAY_AMT").change (function ()}

    If ($("#P141_DOWNPAY_AMT").val () > $("#P141_PROP_COST").val ())

    {

    Alert ("section may be no greater than the basic price");

    }

    on the other

    {var y = ($("#P141_DOWNPAY_AMT").val () / ($("#P141_PROP_COST").val ())) * 100;}

    y = Math.Round (y);

    $("#P141_DOWNPAY_PERC").val (y) ;}

    });

    {$("#P141_PREM_PERC").change (function ()}

    var x = ($("#P141_PREM_PERC").val () / 100) * $("#P141_PROP_COST").val ();

    $("#P141_PREM_AMT").val (x);

    });

    {$("#P141_PREM_AMT").change (function ()}

    If ($("#P141_PREM_AMT").val () > $("#P141_PROP_COST").val ())

    {

    Alert ("section may be no greater than the basic price");

    }

    on the other

    {var z = ($("#P141_PREM_AMT").val () / ($("#P141_PROP_COST").val ())) * 100;}

    z = Math.Round (z);

    $("#P141_PREM_PERC").val (z) ;}

    });

    Any help.

    Concerning

    Pa

    'Problems of implicit conversion' comes to mind when I see this:

    : P141_TOTAL_SELL_PRICE: =: P141_DOWNPAY_AMT +: P141_PREM_AMT;

    This is similar to the problems I've seen when using the default formats for the Date Picker Item Types.

    I will add in some APEX_DEBUG. MESSAGE() lines to check what are the string values.

    (remember, all bind variables are of type VARCHAR2)

    You should maybe explicitly to convert strings to numbers using TO_NUMBER() and include the appropriate format.

    (a bit like you have to do with the conversion of strings to dates.)

    My $0.02 worth

    MK

  • Process apex Pl/SQL error: ORA-06502: PL/SQL: digital error or value: specified incorrect LOB Locator

    Apex 4.2

    I searched through the forums of the research about this error, but I do not understand what to do from here. I am writing a process that sends an e-mail when a value of the claim is made (or on a button click). Procedure is as follows:

    DECLARE
       l_body        clob;
       l_body_html   clob;
       l_subject    varchar2(100);
    
    BEGIN
      
    l_body := empty_clob();
    l_body_html := empty_clob();
    
    
    IF V('REQUEST') in ('SAVE_ME') AND :P32_PARENT_UPDATED_FL IS NOT NULL THEN
       l_subject :=  'Survey Job Request Updated'||utl_tcp.crlf||utl_tcp.crlf;
       l_body := 'Update'||utl_tcp.crlf;
    
       l_body_html := '<html>
          <head>
             <style type = "text/css">
                 /* Can add style attributes later */
             </style>
          </head>
          <body>'||utl_tcp.crlf;
       l_body_html := l_body_html ||'Survey Job Request has been updated.<br /><br />'||utl_tcp.crlf;
       l_body_html := l_body_html ||'Title: '||utl_tcp.crlf;
       l_body_html := l_body_html ||:P32_TITLE||utl_tcp.crlf;
       l_body_html := l_body_html ||'<br />Request Category : '||utl_tcp.crlf;
       l_body_html := l_body_html ||:P32_REQUEST_CATEGORY||utl_tcp.crlf;
       l_body_html := l_body_html ||'<br />Update Date: '||utl_tcp.crlf;
       l_body_html := l_body_html ||:P32_UPDATE_DATE||utl_tcp.crlf;
       l_body_html := l_body_html ||'<br />Updated By: '||utl_tcp.crlf;
       l_body_html := l_body_html ||:P32_LAST_EDITED_BY_USERID||utl_tcp.crlf;
       l_body_html := l_body_html ||'</body></html>';
    
    
    
    
    
    END IF;
    
    :P32_CANCELLATION_REASON := l_body_html;
    
    apex_mail.send(
       p_to             =>  '[email protected]',
       p_from           =>  '[email protected]',
       p_body           =>  l_body_html,
       p_body_html      =>  l_body_html,
       p_subj           =>  l_subject);
    
    END;
    
    
    
    
    
    
    
    
    
    

    I added two lines to the code (lines 08 and 09) and when I run my program, I now get the error:

    • ORA-21560: 3 argument is null, invalid or out of range

    Without these two lines, I received the error:

    ORA-06502: PL/SQL: digital error or value: specified incorrect LOB Locator

    I'm not quite sure what is wrong or what I can change. There seems to be right, and in fact, it worked before. I have no idea why this error keeps popping up. Any help on that would be great. Thanks in advance.

    Hello

    NewApexCoder wrote:

    Hmmm... good point. I think that apex_mail.send must be called inside the IF block. But in the future, I added several conditional statements, won't I need to include the apex_mail.send function in each IF block? But at the same time, there is the case that if no conditional instructions are met? Tests, when none of the conditions are true (when I had a second IF block in the code), an email would not be defined, which is correct. Could that be causing a problem however. If the IF block is not filled could he always try to send an email about anything or the l_body_html and l_subject fields have in them the garbage that causing ORA error?

    If the call to the procedure of sending (it is a procedure, and not a function) many times is necessary or useful depends on exactly what you're trying to do.

    For example, you can write to Santa for

    • Submit a wish list
    • Change of address
    • Contradiction with your boss, who can you tell Santa you were mean

    or any combination of these grounds.  If you want to send a simple email whenever any of the conditions are met (and not send a when none are met), then you could do something like this:

    DECLARE

    need_to_send BOOLEAN: = FALSE;

    ...

    BEGIN

    ...

    IF wish_list IS NOT NULL

    THEN

    l_body: = l_body | ...

    need_to_send: = TRUE;

    END IF;

    IF old_addresss <> new_address

    THEN

    l_body: = l_body | ...

    need_to_send: = TRUE;

    END IF;

    IF boss_is_a_big_fat_liar

    THEN

    l_body: = l_body | ...

    need_to_send: = TRUE;

    END IF;

    IF need_to_send

    SO - It's the only call to send

    apex_mail. Send...

    In any case, the error message ' ORA-21560: argument 3 sucks...» "is pretty clear: If you have not given a value to everything you're passing as p_body, then you'd better call the procedure.

  • ORA-06502: PL/SQL: digital error or the value in the conversion for a long TIME on the CLOB type

    Hello

    I have an EA of RDBMS Oracle 11.2.0.4.

    I ger the following error when I try to convert a data type LONG to type CLOB data thanks to a PL/SQL procedure:

    declare
    v_prefix varchar2 (20): = null;
    v_text_view_clob clob: = null;
    long v_text_view_long: = null;

    cursor c_v
    is
    Select
    a.view_name as view_name
    Of
    USER_VIEWS one;

    Start
    for r_v in c_v
    loop
    Start
    v_text_view_clob: = null;
    v_text_view_long: = null;

    -Do the SQL code of the view
    Select
    a.Text text
    in
    v_text_view_long
    Of
    USER_VIEWS one
    where
    a.view_name = r_v.view_name;

    v_text_view_clob: = v_text_view_long;

    update of ohibo_views one
    set
    a.view_text = v_text_view_clob
    where
    a.view_name = r_v.view_name;
    exception
    while others then
    dbms_output.put_line ('View =' | r_v.view_name |) "kan niet worden geconverteerd!");
    dbms_output.put_line (substr (sqlerrm, 1, 60));
    end;
    end loop;
    -commit;
    exception
    while others then
    lift;
    end;
    /

    I get the error a specific record:

    View = VER_POLISMUTATIES_VW kan niet worden geconverteerd!

    ORA-06502: PL/SQL: digital error or value

    At looked the origina; Value of type LONG and it is indeed a "long" piece of text.

    However, CLOB has a restriction about 4G * db_block_size and LONG 2 G - 1 according to the documentation.

    I should be able with the method above to convert a LONG in CLOB.

    Anyone had a similar situation?

    Thanks in advance for advice how to solve.

    Kind regards

    PS: my apologies, I didn't know which group to post this discussion: database or PL/SQL.

    Good indeed, a link with the right explanation.

    I didn't know that there was such a function.

    Thank you!

    Kind regards

  • ORA-06502: PL/SQL: digital error: error in the conversion of char to number

    Hello world.

    I have a strange problem here. I'll try to explain better. I work with APEX 4.2 and of Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production.

    Here are my parameters NLS_SESSION_PARAMETER and NLS_DATABASE_PARAMETER: NLS_NUMERIC_CHARACTERS,.


    I have a table with a lot of body numbers, and when I imported a MS Access application data, all fields were imported with the comma as decimal separator.


    Now, I have a form with several fields of number and when I leave a numeric field, a body of numbers of amount total is calculated and automatically filled with a bit of javascript.


    Now the problem: calculating fields (sum) succeeds only when I use the decimal as the delimiter. If I use the comma, I get a NaN value in the total amount field. I managed to convert all commas in points with javascript, so the total amount is calculated.

    When I try to save the record, I get the error: ORA-06502: PL/SQL: digital error: error in the conversion of char to number because I'm trying to save the separator point in my number fields.


    I tried to use REPLACE function to replace the. by one, before winning but does not solve the problem.


    This sounds familiar to anyone?


    Thanks in advance.



    OK, the problem is solved people.

    Somehow, the registration procedure had an influence on another calculation of my form and the error came from this process. So I put a to_number and replace stated in the calculation and all records very well and it shows my total.

  • ORA-06502: PL/SQL: digital error or value

    Hello

    We have a package with a cursor that returns the session information:

    create or replace 
    PACKAGE BODY             "LOGIN_AUDIT" 
    ...
    ...
      CURSOR session_cur IS
        SELECT * FROM v$session WHERE audsid=USERENV('sessionid');
    
     session_rec session_cur%ROWTYPE;
    
    ...
    
    FUNCTION get_osuser
        RETURN VARCHAR2
      IS
      BEGIN
        RETURN session_rec.osuser;
      END;
    
    FUNCTION get_dbuser
        RETURN VARCHAR2
      IS
      BEGIN
        RETURN NVL(session_rec.username, 'ORACLE_SYS');
      END;
    
    ...
    

    The package compiled successfully and works ok out for a function that is the get_osuser. When you launch sqlplus, we get the following error:

    Select double LOGIN_audit.get_osuser;

    *

    ERROR on line 1:

    ORA-06502: PL/SQL: digital error or value

    ORA-06512: at "APPUSR. LOGIN_AUDIT', line 94

    ORA-06512: at "APPUSR. LOGIN_AUDIT', line 102

    The APPUSR has select priv on V$ SESSION and a select * from v$ session returns the session information. We can perform any other function since the package without any problem, for example:

    APPUSR@APPD > select double login_audit.get_dbuser;

    GET_DBUSER

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

    APPUSR

    Can someone help us work on what happens please.

    PS Oracle: 11.2.0.3, OS Windows 2008 server.

    Thank you

    Really I have not aside, this and raise the question?

    Why you write all this code?

    wouldn't the following very good enough?

    1. FUNCTION get_osuser RETURN VARCHAR2;                    Use sys_context ('USERENV', 'OS_USER')
    2. FUNCTION get_dbuser RETURN VARCHAR2;                    Use sys_context ('USERENV', 'SESSION_USER')
    3. FUNCTION get_client_info RETURN VARCHAR2;                   Use sys_context ('USERENV', 'CLIENT_INFO')
    4. FUNCTION get_module_info RETURN VARCHAR2;               Use sys_context ('USERENV', 'MODULE')
    5. FUNCTION get_action_info RETURN VARCHAR2;                  Use sys_context ('USERENV', 'ACTION')

    Just do not know, I see the advantage of messing around with this slider and have to fight with the updating of information and others.

    This would totally work around the error you get and probably accelerate - and make it easier to maintain.

    ??

    Unless there is some additional requirements, that I'm missing

Maybe you are looking for

  • Unable to open Web sites after updating iOS 9.3

    Updated for iOS 9.3 and now find that I can not open all websites from the list put grew to safari. It looks okay and provides a list if Web sites, but none of them opens. All solutions?

  • Problem in conference!

    Did someone faced the same problem as mine... Whenever I am in a call and received another call on hold, then if I want to answer this call waiting I drag response part on display but could never answer any appeal pending. He returned to the default

  • I can't open my email on my pc.

    Original title: email problem I can't open my email on my pc, but I have no problem with my ipad.

  • VHDs for broken IE6 - 8

    I try to use the virtual hard drive for Windows XP IE6-8 here:http://www.Microsoft.com/en-US/Download/details.aspx?displaylang=en&ID=11575 I use virtual disks to make our website run correctly in all native versions of IE. The latest version that has

  • OR DO NOT USE WINDOWS 7 PRO 64-BIT.

    I HAVE AN INTEL (R) PENTIUM (R) DUAL CPU 2390 T @ 1.86 GHZ 1.87 GHZ WITH 3.00 GB. RAM > WILL IT WORK WITH WINDOWS 7 PRO. 64-BIT? OR IT WILL BE BETTER TO STAY WITH WINDOWS 7 PRO. 32 BIT? THANKS, 53 TAXI DRIVER