Ora-01744 error inapproriate into

create or replace FUNCTION BILLING_AMOUNT (p_bill_key IN varchar2) RETURN NUMBER AS
   l_total    NUMBER;
   l_dum_bill NUMBER;
   p_count NUMBER:=0;
BEGIN
   BEGIN
      SELECT count(*) into p_count
      FROM billing_adjust b    where    b.billing_key = p_bill_key and approval_flag='A';
if p_count < 1 then
         SELECT BILLING_AMOUNT
         into l_total FROM mv_billing a
      WHERE  a.billing_key = p_bill_key
      UNION
      SELECT BILLING_AMOUNT
         into l_total     FROM billing a
      WHERE  a.billing_key = p_bill_key;
return  l_total  ;
end if;
   SELECT CORRECT_AMOUNT
     into l_total      FROM mv_billing_adjust b
      WHERE b.billing_key = p_bill_key
      union
      SELECT CORRECT_AMOUNT
       into l_total       FROM billing_adjust b
      WHERE b.billing_key = p_bill_key ;
return l_total;
EXCEPTION  
    WHEN NO_DATA_FOUND THEN
    null; 
End;
   RETURN 0;
END BILLING_AMOUNT;since i am getting error from above so i changed it to the following. can i change the above code to below.
create or replace FUNCTION BILLING_AMOUNT1 (p_bill_key IN varchar2) RETURN NUMBER AS
   l_total    NUMBER;
   l_dum_bill NUMBER;
   p_count NUMBER:=0;
cursor c1 is
SELECT count(*) v_count
      FROM billing_adjust b    where    b.billing_key = p_bill_key and approval_flag='A'
union
SELECT count(*) v_count
      FROM billing_adjust b    where    b.billing_key = p_bill_key and approval_flag='A';
cursor c2 is
SELECT BILLING_AMOUNT
               FROM mv_billing a
      WHERE  a.billing_key = p_bill_key
union
SELECT BILLING_AMOUNT
             FROM billing a
      WHERE  a.billing_key = p_bill_key ;
cursor c3 is
SELECT CORRECT_AMOUNT
         FROM mv_billing_adjust b
      WHERE b.billing_key = p_bill_key
union
SELECT CORRECT_AMOUNT
             FROM billing_adjust b
      WHERE b.billing_key = p_bill_key ;
BEGIN
   BEGIN
      For v1 in c1 loop
         p_count:=v1.v_count;
      End loop;
if p_count < 1 then
         for v2 in c2 loop
         l_total:=v2.BILLING_AMOUNT;     
return  l_total  ;
end loop;
end if;
   for v3 in c3 loop
     l_total:=v3.correct_AMOUNT;  
return l_total;
end loop;
EXCEPTION  
    WHEN NO_DATA_FOUND THEN
    null; 
End;
   RETURN 0;
END BILLING_AMOUNT1;i am not getting any error with this code.

Error in First piece of code -
You cannot store 2 values in the same variable in the same query with the help of a union.
If you are trying to add the amounts , use something like -
SELECT SUM (billing_amount)
  INTO l_total
  FROM (SELECT billing_amount
          FROM mv_billing a
         WHERE a.billing_key = p_bill_key
        UNION
        SELECT billing_amount
          FROM billing a
         WHERE a.billing_key = p_bill_key);Second piece of code really has some issues reg the logic - [not very clear what u trying to achieve]
CREATE OR REPLACE FUNCTION billing_amount1 (p_bill_key IN VARCHAR2)
   RETURN NUMBER
AS
   l_total      NUMBER;
   l_dum_bill   NUMBER;
   p_count      NUMBER := 0;
   CURSOR c1
   IS
      SELECT COUNT (*) v_count
        FROM billing_adjust b  -- what are you trying to do here ???   using same query twice n UNION
       WHERE b.billing_key = p_bill_key AND approval_flag = 'A'
      UNION
      SELECT COUNT (*) v_count
        FROM billing_adjust b
       WHERE b.billing_key = p_bill_key AND approval_flag = 'A';
   CURSOR c2
   IS
      SELECT billing_amount
        FROM mv_billing a
       WHERE a.billing_key = p_bill_key
      UNION
      SELECT billing_amount
        FROM billing a
       WHERE a.billing_key = p_bill_key;
   CURSOR c3
   IS
      SELECT correct_amount
        FROM mv_billing_adjust b
       WHERE b.billing_key = p_bill_key
      UNION
      SELECT correct_amount
        FROM billing_adjust b
       WHERE b.billing_key = p_bill_key;
BEGIN
   BEGIN
      FOR v1 IN c1
      LOOP
         p_count := v1.v_count;  -- you will get same count 2 times as 2 records  ....
      END LOOP;
      IF p_count < 1
      THEN
         FOR v2 IN c2
         LOOP
            l_total := v2.billing_amount;
            RETURN l_total;
         END LOOP;
      END IF;
      FOR v3 IN c3
      LOOP
         l_total := v3.correct_amount;
         RETURN l_total;
      END LOOP;
   EXCEPTION
      WHEN NO_DATA_FOUND
      THEN
         NULL;
   END;
   RETURN 0;
END billing_amount1;If you have any requirement, post table DDL scripts, sample INSERT Statements, expected output, then only many ppl here can help in a better way.

Similar Messages

  • Ora-01744 error inappropriate into.

    Please help to fix this issue. How do i modify it
    create or replace
    FUNCTION BILLING_AMOUNT (p_bill_key IN varchar2) RETURN NUMBER AS
       l_total    NUMBER;
       l_dum_bill NUMBER;
       p_count NUMBER:=0;
    BEGIN
       BEGIN
          SELECT count(*) into p_count
          FROM mv_billing_adjust b    where    b.billing_key = p_bill_key and approval_flag='A';
    if p_count < 1 then
             SELECT BILLING_AMOUNT
             into l_total FROM mv_billing a
          WHERE  a.billing_key = p_bill_key and SUBMIT_STATUS='S'
          UNION
          SELECT BILLING_AMOUNT
             into l_total     FROM billing a
          WHERE  a.billing_key = p_bill_key and SUBMIT_STATUS='S';
    return  l_total  ;
    end if;
       SELECT CORRECT_AMOUNT
         into l_total      FROM mv_billing_adjust b
          WHERE b.billing_key = p_bill_key and APPROVAL_FLAG='A' order by FISC_APPR_DATE desc
    return l_total;
    EXCEPTION  
        WHEN NO_DATA_FOUND THEN
        null; 
    End;
       RETURN 0;
    END BILLING_AMOUNT;

    You havent posted the proble. You just posted some code.
    Explain us what you are trying to do and what is the error you are ghetting
    What is the business logic?
    SELECT BILLING_AMOUNT
             into l_total FROM mv_billing a
          WHERE  a.billing_key = p_bill_key and SUBMIT_STATUS='S'
          UNION
          SELECT BILLING_AMOUNT
             into l_total     FROM billing a
          WHERE  a.billing_key = p_bill_key and SUBMIT_STATUS='S';What are you trying to do here? do you want the sum of billing amount from both the tables?
    assuming that, Your code might be closer to the following.
    CREATE OR REPLACE FUNCTION BILLING_AMOUNT (p_bill_key IN VARCHAR2)
      RETURN NUMBER
    AS
      l_total      NUMBER;
      l_dum_bill   NUMBER; --- why this variable declared? you are not using it.
      p_count      NUMBER := 0;
    BEGIN
      SELECT COUNT (*)
        INTO p_count
        FROM mv_billing_adjust b
       WHERE b.billing_key = p_bill_key
         AND approval_flag = 'A';
      IF p_count < 1
      THEN
        SELECT SUM (BILLING_AMOUNT)
          INTO l_total
          FROM (SELECT BILLING_AMOUNT
                  FROM mv_billing A
                 WHERE A.billing_key = p_bill_key
                   AND SUBMIT_STATUS = 'S'
                UNION
                SELECT BILLING_AMOUNT
                  FROM billing A
                 WHERE A.billing_key = p_bill_key
                   AND SUBMIT_STATUS = 'S');
        RETURN l_total;
      ELSE
        SELECT CORRECT_AMOUNT
          INTO l_total
          FROM mv_billing_adjust b
         WHERE b.billing_key = p_bill_key
           AND APPROVAL_FLAG = 'A'; --IF you are getting only one value. why do you need order by?
        RETURN l_total;
      END IF;
    EXCEPTION
      WHEN NO_DATA_FOUND
      THEN
        RETURN 0;
    END BILLING_AMOUNT;Let us know the logic so that we can give appropriate answer.
    G.

  • Error in Trigger ( PL/SQL: ORA-01744: inappropriate INTO)

    Hi ,
    I've written the trigger in the following format.. As the original trigger is around 700 lines, so just format is written here.. please co-operate..
    CREATE OR REPLACE TRIGGER --
    AFTER UPDATE OF COL1
    ON TAB1
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    WHEN (NOT(OLD.COL1 IS NULL AND NEW.COL1=0))
    DECLARE
    rowToins PAK1.fdList;
    i number;
    BEGIN
    IF :NEW.COL2='V' THEN
    INSERT INTO DEST(
      D_AT)
    SELECT * FROM ( SELECT --
       PAK2.FUN1('AD',TAB10.ID) AS D_AT
    FROM ---
    WHERE --- )
       WHERE D_AT IS NOT NULL;
    ELSEIF :NEW.COL2 ='H' THEN
    SELECT * FROM ( SELECT --
       PAK2.FUN1('AD',TAB9.ID) AS D_AT
    BULK COLLECT INTO rowToins
    FROM ---
    WHERE --- )
       WHERE D_AT IS NOT NULL;
    i:=rowToins.FIRST;
    WHILE i IS NOT NULL LOOP
    --insert row 1
      PAK1.fun2(rowToins(i).<col>,
    i:=rowToins.NEXT(i);
    END LOOP;
    END IF;
    END;
    /The above code is giving the error..
    PL/SQL: ORA-01744: inappropriate INTOSo how can i correct the code...
    thanks

    The line no..are
    159/3 PL/SQL: SQL Statement ignored
    213/16 PL/SQL: ORA-01744: inappropriate INTO
    159 --> the first where condition in the example code
    213 --> the select list column in the second if condition in example code
    If i remove the
    select * from (
    PAK2.FUN1('AD',TAB9.ID) AS D_AT
    WHERE D_AT IS NOT NULL;Then the trigger is created with no issues....
    please let me know if i'm not clear
    Edited by: josh1612 on Apr 27, 2009 3:42 AM

  • Error -ora-01744 ( Inappropriate INTO )

    Hi
    Is it possible to select a record and than insert into another table in stored procedure (9i).
    The same query works. But it shows error in procedure ora-01744
    create or replace procedure SELECT_INSERT
    is
    dept_deptid number;
    dept_deptname varchar2(20);
    begin
    INSERT INTO DEPT (SELECT DEPTID,NAME INTO dept_deptid,dept_deptname from department);
    end SELECT_INSERT;
    Thanks

    Remove paranthesis
    INSERT INTO DEPT
    SELECT DEPTID,NAME
    from department;                                                                                                                                                                               

  • PL/SQL: ORA-01744: inappropriate INTO

    Hi,
    Iam pasted this code this error coming ...
    any one can help me plz....
    select PI.PEN_NUMBER||''(''||(PEN_CAPACITY-(SELECT nvl(SUM(NO_OF_HEAD_IN_PEN),0) from LOT_PEN WHERE PEN_ID=PI.PEN_ID))||'',''||PEN_CAPACITY||'')'' D, PEN_ID R FROM PEN_ID PI'
    report error:
    ORA-06550: line 1, column 100:
    PL/SQL: ORA-01744: inappropriate INTO
    ORA-06550: line 1, column 7:
    PL/SQL: SQL Statement ignored

    Yes you can:
    CREATE TABLE PEN_ID ( PEN_NUMBER NUMBER, PEN_CAPACITY NUMBER, PEN_ID NUMBER PRIMARY KEY );
    CREATE TABLE LOT_PEN ( NO_OF_HEAD_IN_PEN NUMBER, PEN_ID NUMBER PRIMARY KEY );
    SELECT pi.pen_number || '(' || (pen_capacity - (SELECT nvl(SUM(no_of_head_in_pen)
                                                              ,0)
                                                      FROM lot_pen
                                                     WHERE pen_id = pi.pen_id))
                      || ',' || pen_capacity || ') ' d
          ,pen_id r
      FROM pen_id pi;
    0 rows selected.However, are you trying to use this in PL/SQL? and getting PLS-00427: an INTO clause is expected in this SELECT statement ?
    I'm confused why you have two single quotes rather than one throughout and a trailing quote at the end, is this dynamic SQL? is there some other context of which you are not making us aware?

  • ORA-00604 error when trying to insert into a XMLTYPE stored as BINARY

    Hi. Here's the scenario.
    Here's my Oracle version:
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    The database is encoded as AL32UTF8.
    First I create the table...
    create table binary_table (the_field XMLTYPE) XMLTYPE COLUMN the_field STORE AS BINARY XML;
    Now I try and do an insert like this...
    insert into binary_table values (xmltype('<?xml version="1.0" encoding="AL32UTF8"?>' || chr(10) || '&lt;a&gt;b&lt;/a&gt;' || chr(10)));
    and I get this error:
    SQLState: 60000
    ErrorCode: 604
    Position: 122
    Error: ORA-00604: error occurred at recursive SQL level 1
    ORA-00942: table or view does not exist
    If I create the table with a CLOB storage option for the XMLTYPE, the insert works fine. If I repeat these steps in another database instance, same Oracle version, that's encoded as WE8ISO8859P1, it also works fine. It behaves the same in several clients. I also tried it with several different values for NLS_LANG and that didn't help.
    I do want to say that this database instance has just been set up especially for me so I can do some R&D on AL32UTF8 and XMLTYPE to see if it fits our needs. So it might be a problem with the database instance.
    Thanks for taking a look at this.
    Ralph
    Edited by: stryder100 on Jul 24, 2009 12:11 PM

    Hi,
    Use this
    Load data
    append Into TABLE HS_HRMIG_EMP_PER_20MAR07 fields terminated by "," optionally enclosed by '"'
    TRAILING NULLCOLS.
    Here optional enclosed by is for doubles quotes which should needs to place in single quotes.
    like '"'.
    try with this.
    --Basava.S                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Capturing oracle error codes into a variable

    Hi
    Can someone show me how it is possible to save an Oracle defined error code into a variable? What I am trying to do is when a stored procedure fails an Oracle error is raised, such as ORA-xxxx, then pass this code into variable to be saved into a log.
    How do I achieve this?

    user633278 wrote:
    How do I achieve this?Function SQLCODE in PL/SQL exception handler returns error code. SQLERRM returns message:
    SQL> declare
      2      x number;
      3  begin
      4      x := 1/0;
      5    exception
      6      when others
      7        then
      8          dbms_output.put_line('Error code: ' || SQLCODE);
      9          dbms_output.put_line('Error message: ' || SQLERRM);
    10  end;
    11  /
    Error code: -1476
    Error message: ORA-01476: divisor is equal to zero
    PL/SQL procedure successfully completed.
    SQL> SY.

  • Ora-01008 error with bind variable

    Hi,
    We have a test program which have one bind variable on a column which is varchar2(20), in the test program we've passed a 20 character string to the variable. The program returns error in one of the databases but all others are successful. We've checked the column is same in all of them.
    Exception in thread "main" java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1
    ORA-01008: not all variables bound
    Could you please advise how to troubleshoot this issue?
    Regards

    We aren't going to be able to help you if you won't post the database code that is giving the error.
    And now we need the Java code that is constructing the query that you are using.
    Your error is saying there is a second variable that you are not providing a value for.
    And you said
    >
    We have a test program which have one bind variable on a column which is varchar2(20), in the test program we've passed a 20 character string to the variable.
    >
    But you are using a string that is 23 characters long
    "a3g34-b13fd-efaie-f83fk"How does 23 go into 20?

  • Getting error-ORA-24381: error(s) in array DML

    Hi i have written the following code to bulk insert into a database table.
    I am getting an error while returning the result of the bulk insert query into the collection
    I have tried to track it by using sql%bulk_exceptions.error_code.
    But the error code that it is showing is just 1.
    I trapped it using sqlerrm.
    and that is showing-error(s) in array DML
    What do i do?
    DECLARE
       CURSOR temp_rec_tap_cur
       IS
          SELECT *
            FROM temp_records_tap;
       TYPE temp_rec_tab IS TABLE OF temp_rec_tap_cur%ROWTYPE;
       v_test_tab   temp_rec_tab;
       v_rec_num    num_tab;
       v_filename   temp_records_tap.file_name%TYPE;
       v_error_code tap_reject.error_code%type;
       v_rej_value  tap_reject.field_rej%type;                      
       v_errors number;   
    BEGIN
       SELECT file_name
         INTO v_filename
         FROM table1
         WHERE ROWNUM<2;
       OPEN temp_rec_tap_cur;
       LOOP
          BEGIN
             FETCH temp_rec_tap_cur
             BULK COLLECT INTO v_test_tab LIMIT 1000;
             FORALL i IN v_test_tab.FIRST .. v_test_tab.LAST SAVE EXCEPTIONS
                INSERT INTO tapdetail_tapin
                     VALUES v_test_tab (i)
                  RETURNING record_num
                    BULK COLLECT INTO v_rec_num;
          EXCEPTION
             WHEN DUP_VAL_ON_INDEX
             THEN
                NULL;
             WHEN OTHERS
             THEN
             v_errors:=sql%bulk_exceptions.count;
             for i in 1..v_errors
             loop
             dbms_output.put_line(sql%bulk_exceptions(i).error_code);
             p3_errorlog ('TAPINDETAWARE', SQLERRM, v_filename);     
             end loop;
             END;
                --RAISE;
          EXIT WHEN temp_rec_tap_cur%NOTFOUND;
       END LOOP;
    INSERT INTO table2
    SELECT file_id, file_name, sender_pmn, recipient_pmn, call_date,
                 call_date_only, call_type, call_number, FIRST_RECORD,
                 service_type, service_code, home_bid, serve_bid,
                 chargeable_subs_type, imsi_min, msisdn_mdn, air_charges,
                 air_charges_sdr, air_time, national_call_charges,
                 national_call_charges_sdr, national_call_time,
                 international_call_charges, international_call_charges_sdr,
                 international_call_time, dir_assist_charges,
                 dir_assist_charges_sdr, dir_assist_time, other_charges,
                 other_charges_sdr, other_time, volume_charges,
                 volume_charges_sdr, volume_units, tot_charges, tot_charges_sdr,
                 tot_duration, state_tax, state_tax_sdr, local_tax,
                 local_tax_sdr, state_and_use_tax, state_and_use_tax_sdr, va_tax,
                 va_tax_sdr, other_tax, other_tax_sdr, charge_refund_indicator,
                 advised_charge_currency, advised_charge, advised_charge_sdr,
                 advised_charge_commission, advised_charge_commission_sdr,
                 exchange_rate, mcc, mnc, process_date, chargeable_units,
                 record_num, mscid,null,null,decode(call_type,0,'250',1,'251',5,'255'),null,'Duplicate Call'
                 from temp_records_tap
                 where record_num not in (select column_value from table(v_rec_num)) ;
    EXCEPTION
    WHEN OTHERS THEN
    p3_errorlog ('TAP', SQLERRM, v_filename);  
    END;Edited by: user8731258 on Sep 14, 2010 2:58 AM
    Edited by: user8731258 on Sep 14, 2010 3:01 AM

    What is the type declaration of num_tab and how is record_num defined?
    ORA-24381: error(s) in array DML
    Cause: One or more rows failed in the DML.indicates that you fail on the insert itself. Are the table definitions the same? Same primary/unique keys?
    Edited by: MBr on 14-Sep-2010 03:16

  • PL/SQL: ORA-04052: error occurred when looking up remote object.

    Hi All,
    I'm getting the following error message while executing a PL/SQL Block.
    PL/SQL: ORA-04052: error occurred when looking up remote object UPLDUSER.filestatushistory@FTS
    ORA-00604: error occurred at recursive SQL level 1
    ORA-03106: fatal two-task communication protocol error
    ORA-02063: preceding line from FTSStatement
    declare
    v_coun number;
    begin
    select count(*) into v_coun
    from updluser.filestatushistory@fts;
    end;Back ground of the situation as follows,
    My DataBase version 10.2.0.3 DB Name :DB1
    Table Owner : UPLDUSER
    Table Name : FILESTATUSHISTORY
    I have a report user on the same database and I have grant all on the above table to report user
    Report User : RPT_FTS
    SQL> GRANT ALL ON FILESTATUSHISTORY_V TO RPT_FTS;Now Please find the below database details where I'm getting subjected error.
    Database version : 9.2.0.8
    DB Name : DB2
    User Name : RPT_REPORTS
    I Have create a dblink from RPT_REPORTS to RPT_FTS on DB1 and the dblink works fine. But getting the above error while running it.
    but When I do the same other 10.2.0.3 db , the above PL/SQL block works fine without any problem.
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    Now the strange about this is that I have Created a new table on DB1 db like below;
    SQL> CREATE TABLE UPLDUSER.ABC AS SELECT * FROM FILESTATUSHISTORY;and retry my code on DB2 (9.2.0.8) after changing the table to ABC and it worked. Now I don't know whats wrong with a original table(FILESTATUSHISTORY).
    To over come the problem and a work-a-round method I create a view on the DB1 (RPT_FTS) like the below
    SQL> CREATE VIEW FILESTATUSHISTORY AS SELECT * FROM UPLDUSER.FILESTATUSHISTORY;and was able to run the PL/SQL block Remotely.
    Just wants To know what whould have been the cause for this .
    Cheers
    Kanchana

    Hi Kanchana,
    Perhaps following link of google search has answer to your query
    ORA-04052. The search result contains some useful articles whose URLs I shan't post in the forums.
    HTH!
    *009*

  • ORA-1555  ORA-3136 errors:: elapsed time vs Query Duration

    Dear all,
    - My Database version is 11.2.0.2, Solaris.
    - We have been having a problem in the production database where the front end nodes start going up and down for couple of hours sometimes. ; When node flapping is going on we get connection timed out alerts.
    WARNING: inbound connection timed out (ORA-3136) opiodr aborting
    process unknown ospid (4342) as a result of ORA-609 opiodr aborting
    process unknown ospid (4532) as a result of ORA-609 opiodr aborting
    process unknown ospid (4534) as a result of ORA-609 opiodr aborting....
    Since this week node flapping is happening every day. Since past 2 days after or during node flapping we are getting ORA-1555 error.
    Extract from alert log error:
    ORA-01555 caused by SQL statement below (SQL ID: g8804k5pkmtyt, Query Duration=19443 sec, SCN: 0x0001.07bd90ed):
    SELECT d.devId, d.vendor, d.model, d.productClass, d.oui, d.parentDeviceId, d.created, d.lastModified AS devLastMod, d.customerId, d.userKey1, d.userKey2, d.userKey4, d
    .userKey5, d.firmwareFamily, d.softwareVer, d.serialNum, d.ip, d.mac, d.userKey3, d.userKey6, d.provisioningId, d.status, d.classification, d.population, d.name, d.ipRe
    solver, d.ipExpirationTime, d.geoLocationId,contact.firstContactTime, ifaces.id, ifaces.type AS ifaceType, ifaces.lastModified AS ifaceLastMod, ifaces.timeoutname, ifac
    es.username1, ifaces.password1, ifaces.username2, ifaces.password2, ifaces.connReqUrl, ifaces.connReqScheme, ifaces.srvNonce, ifaces.deviceNonce, ifaces.phoneNumber,ifa
    ces.bootstrapSecMethod, ifaces.srvAuthentication, ifaces.deviceAuthentication, ifaces.userPIN, ifaces.networkID, ifaces.omaSessionID, ifaces.portNum, ifaces.mgtIp, ifac
    es.cmtsIp, ifaces.mgtReadCommunity, ifaces.mgtWriteCommunity, ifaces.cmtsReadCommunity, ifaces.cmtsWriteCommunity, devto.name AS devtoName, devto.rebootTimeout, devto.sessionInitiationI run Statspack report from the whole day duration, and looking into the elapsed time in seconds no more than 3739.61 sec (too lower than run duration in the alert log file of 19443 sec); So I would like to know if there is any co-relations between the ORA-3136 errors and the ORA-1555 errors?
       CPU                  CPU per             Elapsd                     Old
      Time (s)   Executions  Exec (s)  %Total   Time (s)    Buffer Gets  Hash Value
    tTime <= :3 ) AND (endTime IS NULL OR endTime >= :4 )
       2773.77    7,787,914       0.00    3.4    3739.61     112,671,645 1909376826
    Module: JDBC Thin Client
    SELECT d.devId, d.vendor, d.model, d.productClass, d.oui, d.pare
    ntDeviceId, d.created, d.lastModified AS devLastMod, d.customerI
    d, d.userKey1, d.userKey2, d.userKey4, d.userKey5, d.firmwareFam
    ily, d.softwareVer, d.serialNum, d.ip, d.mac, d.userKey3, d.user
    SQL> show parameter UNDO_MANAGEMENT
    NAME                                 TYPE        VALUE
    undo_management                      string      AUTO
    SQL> show parameter UNDO_RETENTION
    NAME                                 TYPE        VALUE
    undo_retention                       integer     10800BR,
    Diego

    Thank you. Please let me know if it is enough or you need more information;
    SQL ordered by Gets  DB/Inst: DB01/db01  Snaps: 14835-14846
    -> End Buffer Gets Threshold:    100000 Total Buffer Gets:     677,689,568
    -> Captured SQL accounts for   73.6% of Total Buffer Gets
    -> SQL reported below exceeded  1.0% of Total Buffer Gets
                                                         CPU      Elapsd     Old
      Buffer Gets    Executions  Gets per Exec  %Total Time (s)  Time (s) Hash Value
         21,286,248    2,632,793            8.1    3.4   666.73    666.76 3610154549
    Module: JDBC Thin Client
    SELECT d.devId, d.vendor, d.model, d.productClass, d.oui, d.pare
    ntDeviceId, d.created, d.lastModified AS devLastMod, d.customerI
    d, d.userKey1, d.userKey2, d.userKey4, d.userKey5, d.firmwareFam
    ily, d.softwareVer, d.serialNum, d.ip, d.mac, d.userKey3, d.user
         17,029,561    1,176,849           14.5    2.7   417.32    416.73 1909376826
    Module: JDBC Thin Client
    SELECT d.devId, d.vendor, d.model, d.productClass, d.oui, d.pare
    ntDeviceId, d.created, d.lastModified AS devLastMod, d.customerI
    d, d.userKey1, d.userKey2, d.userKey4, d.userKey5, d.firmwareFam
    ily, d.softwareVer, d.serialNum, d.ip, d.mac, d.userKey3, d.user
         17,006,795           37      459,643.1    2.7   367.61    368.95 4045552861
    Module: JDBC Thin Client
    SELECT d.devId, d.vendor, d.model, d.productClass, d.oui, d.pare
    ntDeviceId, d.created, d.lastModified AS devLastMod, d.customerI
    d, d.userKey1, d.userKey2, d.userKey4, d.userKey5, d.firmwareFam
    ily, d.softwareVer, d.serialNum, d.ip, d.mac, d.userKey3, d.userAnother Statspack report for the whole day shows;
    SQL ordered by CPU  DB/Inst: DB01/db01  Snaps: 14822-14847
    -> Total DB CPU (s):          82,134
    -> Captured SQL accounts for   40.9% of Total DB CPU
    -> SQL reported below exceeded  1.0% of Total DB CPU
        CPU                  CPU per             Elapsd                     Old
      Time (s)   Executions  Exec (s)  %Total   Time (s)    Buffer Gets  Hash Value
    tTime <= :3 ) AND (endTime IS NULL OR endTime >= :4 )
       2773.77    7,787,914       0.00    3.4    3739.61     112,671,645 1909376826
    Module: JDBC Thin Client
    SELECT d.devId, d.vendor, d.model, d.productClass, d.oui, d.pare
    ntDeviceId, d.created, d.lastModified AS devLastMod, d.customerI
    d, d.userKey1, d.userKey2, d.userKey4, d.userKey5, d.firmwareFam
    ily, d.softwareVer, d.serialNum, d.ip, d.mac, d.userKey3, d.user
    SQL ordered by Gets  DB/Inst: DB01/db01  Snaps: 14822-14847
    -> End Buffer Gets Threshold:    100000 Total Buffer Gets:   1,416,456,340
    -> Captured SQL accounts for   55.8% of Total Buffer Gets
    -> SQL reported below exceeded  1.0% of Total Buffer Gets
                                                         CPU      Elapsd     Old
      Buffer Gets    Executions  Gets per Exec  %Total Time (s)  Time (s) Hash Value
         86,354,963    7,834,326           11.0    6.3  2557.34   2604.08  906944860
    Module: JDBC Thin Client
    SELECT d.devId, d.vendor, d.model, d.productClass, d.oui, d.pare
    ntDeviceId, d.created, d.lastModified AS devLastMod, d.customerI
    d, d.userKey1, d.userKey2, d.userKey4, d.userKey5, d.firmwareFam
    ily, d.softwareVer, d.serialNum, d.ip, d.mac, d.userKey3, d.user
    .....BR,
    Diego
    Edited by: 899660 on 27-ene-2012 7:43
    Edited by: 899660 on 27-ene-2012 7:45

  • ORA-00604: error occurred at recursive SQL level 1 (Call to a Oracle View)

    I have created a view that refers to a package function within the sql select.
    Like
    E.x
    CREATE OR REPLACE VIEW VW_TAX
    as select
    test_pkg.fn_get_gl_value(acct_id) desired_col1,
    test_pkg.fn_get_gl_desc_value(acct_id) desired_col2
    From tables a, b
    a.col= b.col
    The sample function( fn_get_gl_value) is embedded into a package (test_pkg).
    Function fn_get_gl_value:
    It earlier referred to table A1, B1, C1 and this query took really long, Therefore I used object type tables and stored the values required once within the package when it is invoked. Later I used the Tables A1, B1 and C1(table Cast from the type Table Loaded in Package Memory)
    The query was fast and fine, but now when I try to re-use the view
    select * from VW_TAX
    where acct_id = '02846'
    It fails with this message
    09:32:35 Error: ORA-00604: error occurred at recursive SQL level 1
    ORA-01000: maximum open cursors exceeded
    Note: The database is Oracle8i Enterprise Edition Release 8.1.7.4.0.
    Maximum cursors database is 500
    Please let me know if there is any known solution,
    Appreciate all your help
    Thanks
    RP

    Seems like your OPEN_CURSORS init.ora parameter is set too low.
    See Metalink Note:1012266.6 for details.
       ORA-01000: "maximum open cursors exceeded"
            Cause: A host language program attempted to open too many cursors.
                   The initialization parameter OPEN_CURSORS determines the
                   maximum number of cursors per user.
           Action: Modify the program to use fewer cursors. If this error occurs
                   often, shut down Oracle, increase the value of OPEN_CURSORS,
                   and then restart Oracle.

  • ORA-00604: error occurred at recursive SQL level

    I only have 2 users and approx 9 schemas.
    Why is this complaining about maximum cursors??
    Error message:
    ORA-00604: error occurred at recursive SQL level
    ORA-01000: maximum open cursors exceeded
    ORA-0064 error occurred at recursive SQL level
    Cause:
    An error occurred at recursive SQl level
    (a statement applying to internal dictionary tables)
    >>
    Created 2 users
    1) boundaries (User)
    has a couple of schema.
    National, provincial, district, village
    I have set-up the Primary & Foreign keys.
    Only 1 table has 1 row of data
    2) Projects (User)
    Set up one table - Program
    Program has a Primary Key.
    Foreign key is linked to (boundaries) national PK
    The problem occured when I entered data into boundaries.national

    Clive_S wrote:
    OS: Windows Server 2008 standard - 64 bit.
    Select * from v$version
    Oracle Database 11g release 11.1.0.7.0 - 64 bit
    PL/SQL release 11.1.0.7.0 - production core 11.1.0.7.0
    Production TNS for 64-bit windows: 11.1.0.7.0
    Production NLSRTL for 64-bit windows: 11.1.0.7.0
    I am trying to replicate in Oracle what I would do in SQL Server. There's your first mistake. There are too many differences. My first programming language was COBOL, but I don't write other languages as if they were COBOL.
    I cannot attach an image of the users & tablespace, to illustrate.Another reason to work in sqlplus.
    >
    I created 2 User = Boundaries and Project
    I created several schemas (tables)No, you created 2 schemas. One user = one schema = one user.
    A schema is not a table and a table is not a schema. A schema is a collection of objects, which can include multiple tables but only those owned by one username.
    >
    Boundaries (user)
    Tables:
    Country
    Province
    District
    Village
    Projects (user)
    Tables:
    Program
    Project.Program has a FK = Country that is linked to Boundaries.Country
    I need to create several scemas (databases):Another difference. a schema is not a database, though the sql server concept of a database is somewhat analogous to an oracle schema.
    Boundaries, Project, Assets.
    There are foreign keys linking the various schemas.FKs link tables not schemas.
    Edited by: EdStevens on Feb 26, 2010 10:30 AM

  • ORA-00604: error occurred at recursive SQL when calling proc via db_link

    Hi,
    I'm on 9.2.0.8 and got strange issue with simple test case
    on source db:
    CREATE OR REPLACE PROCEDURE ADMIN.gg_ref(out_tokens OUT SYS_REFCURSOR) is
      BEGIN
      OPEN out_tokens for select dummy from dual;
    END ;
    Now testing code localy:
    SQL> var r refcursor
    SQL> declare
      2   output sys_refcursor;
      3  begin
      4   adminx.gg_ref(output);
      5  :r:=output;
      6  end;
      7  /
    PL/SQL procedure successfully completed.
    SQL> print r
    D
    X
    So its working.
    I've got db_link to that db , and now call that proc via dblink from other 9.2.0.8 DB:
    var r refcursor
      1  declare
      2   output sys_refcursor;
      3  begin
      4   admin.gg_ref@LINK_NAME(output);
      5  :r:=output;
      6* end;
    SQL> /
    declare
    ERROR at line 1:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-00900: invalid SQL statementWhats wrong with my code ?
    Are there any restriction I'm not aware of ?
    Regards
    GregG

    GregG wrote:
    What should my code look like now ?
    Should I rewrite this as function returning index by collection or something ?You can use DBMS_SQL - but use the remote package and not the local one. This is a little bit more complex ito call interface than using a ref cursor, but is the very same thing on the server side. DBMS_SQL also provides a more comprehensive set of features than using the ref cursor interface.
    The main issue though is additional coding - as DBMS_SQL is a lower level interface (a lot closer to the real Oracle Call Interface/OCI):
    --// on remote database the procedure returns a DBMS_SQL cursor instead of a ref cursor
    SQL> create or replace procedure FooProc( cur in out number, deptID number ) is
      2          rc      number;
      3  begin
      4          cur := DBMS_SQL.open_cursor;
      5 
      6          DBMS_SQL.parse(
      7                  cur,
      8                  'select ename from emp where deptno = :deptID',
      9                  DBMS_SQL.native
    10          );
    11 
    12          DBMS_SQL.Bind_Variable( cur, 'deptID', deptID );
    13 
    14          rc := DBMS_SQL.Execute( cur );
    15  end;
    16  /
    Procedure created.
    --// from the local database side we call this remote proc
    SQL> declare
      2          c               number;  --// instead of using sys_refcursor
      3          empName         varchar2(10); --// buffer to fetch column into
      4  begin
      5          FooProc@testdb( c, 10 );  --/ call the proc that creates the cursor
      6 
      7          --// we need to define our fetch buffer for the 1st column in the
      8          --// SQL projection of that cursor (10 byte fetch buffer for 1st column)
      9          DBMS_SQL.define_column@testdb( c, 1, empName, 10 );
    10 
    11          --// we now fetch from this cursor, but via the DBMS_SQL
    12          --// interface
    13          loop
    14                  --// fetch the row (exit when 0 rows are fetched)
    15                  exit when DBMS_SQL.Fetch_Rows@testdb( c ) = 0;
    16 
    17                  --// copy value of 1st column in row into the local PL/SQL buffer
    18                  DBMS_SQL.column_value@testdb( c, 1, empName );
    19 
    20                  --// record value it via dbms output
    21                  DBMS_OUTPUT.put_line( 'name='||empName||' deptID=10' );
    22          end loop;
    23 
    24          --// close it explicitly as you would a ref cursor
    25          DBMS_SQL.Close_Cursor@testdb( c );
    26  end;
    27  /
    name=CLARK deptID=10
    name=KING deptID=10
    name=MILLER deptID=10
    PL/SQL procedure successfully completed.
    SQL>

  • ORA-31061 error while creating XMLType table with virtual column

    I'm not calling it frustration ;)
    but still... what about this one :
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Express Edition Release 11.2.0.2.0 - Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE    11.2.0.2.0      Production
    TNS for 32-bit Windows: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    SQL> create table test_virtual of xmltype
      2  xmltype store as binary xml
      3  virtual columns (
      4    doc_id as (
      5      xmlcast(
      6        xmlquery('/root/@id'
      7        passing object_value returning content)
      8        as number
      9      )
    10    )
    11  )
    12  ;
    Table created.Now, on the latest version :
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0      Production
    TNS for 32-bit Windows: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    SQL> create table test_virtual of xmltype
      2  xmltype store as binary xml
      3  virtual columns (
      4    doc_id as (
      5      xmlcast(
      6        xmlquery('/root/@id'
      7        passing object_value returning content)
      8        as number
      9      )
    10    )
    11  )
    12  ;
          passing object_value returning content)
    ERROR at line 7:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-31061: XDB error: dbms_xdbutil_int.get_tablespace_tab
    ORA-06512: at "XDB.DBMS_XDBUTIL_INT", line 1002Is there something I should be aware of?
    Right now, I'm just evaluating the version so I can't submit any SR.
    Thanks for anyone trying to reproduce the issue.

    Just tested again on a new installation (64-bit server).
    It works :
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE     11.2.0.3.0     Production
    TNS for 64-bit Windows: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    SQL>
    SQL> create table test_virtual of xmltype
      2  xmltype store as binary xml
      3  virtual columns (
      4    doc_id as (
      5      xmlcast(
      6        xmlquery('/root/@id'
      7                 passing object_value returning content)
      8        as number
      9      )
    10    )
    11  );
    Table created
    Now I'll try to see what are the differences between the two installations.
    Thanks Dan and Marco for looking into this.
    Edited by: odie_63 on 2 mai 2012 15:51

Maybe you are looking for

  • Hi support team

    Good day, I'm just change to iPhone 5 few days.. And I was newbie here for iPhone. I wanted to purchase apps in App Store. After I typed in all my data of debit card but keep having the problem of " invalid security code " I'm kinda frustrated about

  • Tablet won't connect with static LAN IP address

    Today I updated my Xperia tablet (model SGP311) to Android 4.4.2 (kernel version 3.4.0-perf-g32ce454). My tablet no longer connects to my home wi-fi network if I assign it a static LAN IP address. It connects fine if I use DHCP. But I prefer to assig

  • Sharing itunes between accounts.

    Hi there, first time discussions user here. I have my iphone synced with itunes no problem, I now wish to sync my wife's iphone, so have set up her own account on our mac,up until now she's just used mine, so that she can have all her own settings, m

  • How to make "Adobe PDF" printer quiet  (no banner) when called from MSAccess?

    I have an Access Database which creates reports set up to print to the "Adobe PDF" printer (Acrobat Standard 7.0.7). Everything works great except the pop-up progress window appears during printing and takes over windows control briefly, then when pr

  • Two qaaws in one dashboard

    Hello experts, Can some one let me know if we can use more than one qaaws to a single dashboard, I have two qwaas connected to same query(to pull the overall results). if all the three fed data to dashboard will it make the query run three times? par