PLS-00642: local collection types not allowed in SQL statements

Hi,
I want to retrieve empno in plsql table.
Now based on the empno in plsql table I want to retrieve thier deptno in another plsql table/varray.
SQL> declare
  2   type vdeptno  is table of number;
  3    v_deptno vdeptno;
  4    TYPE e_tab is table of  PLS_INTEGER INDEX BY PLS_INTEGER;
  5    empno_tab e_tab;
  6   Begin
  7  Select empno bulk collect into empno_tab FROM emp;
  8  FOR i in empno_tab.FIRST..empno_tab.LAST
  9  LOOP
10   dbms_output.put_line(empno_tab(i));
11   Select deptno into v_deptno
12   FROM emp
13    where empno=empno_tab(i);
14   END loop;
15  END;
16  /
Select deptno into v_deptno
ERROR at line 11:
ORA-06550: line 11, column 21:
PLS-00642: local collection types not allowed in SQL statementsAny other way to do the same.
Twinkle

When you use this method ...
type vdeptno is table of number;
v_deptno vdeptno;
You need to allocate space to the object prior to inserting into it , (use .EXTENDS for this). Or you need to initialize it while declaring it.
or try the following
SQL> declare
2 type vdeptno is table of number;
3 v_deptno vdeptno;
4 TYPE e_tab is table of PLS_INTEGER INDEX BY PLS_INTEGER;
5 empno_tab e_tab;
6 Begin
7 Select empno bulk collect into empno_tab FROM emp;
8 FOR i in empno_tab.FIRST..empno_tab.LAST
9 LOOP
10 dbms_output.put_line(empno_tab(i));
11 Select deptno bulk collect into v_deptno
12 FROM emp
13 where empno=empno_tab(i);
14 END loop;
15 END;
16 /
Edited by: user9276238 on Jun 14, 2010 3:26 AM

Similar Messages

  • Error-local collection types not allowed in SQL statements

    TYPE WEEK_NUM_T  IS VARRAY(10) OF VARCHAR2(10);
    vc_weeknum WEEK_NUM_T;
    SELECT DISTINCT to_char(y.week_number_in_year) BULK COLLECT INTO vc_weeknum
        FROM DD_TMP x, TIME y
        WHERE x.DATE_TM = y.ORACLE_DATE;
    INSERT INTO TMP_HOLD
        (SELECT *
             FROM TMP
             WHERE DATE_TM IN (SELECT * FROM TABLE(vc_weeknum));It seems like the TABLE() function don't work. What is the workaround?

    You haven't provided enough of your code to tell, but you are probably trying to use a pl/sql type instead of a sql type. Please see the reproduction of error, then correction below.
    -- reprouction of error:
    scott@ORA92> CREATE TABLE tmp_hold AS SELECT * FROM dept WHERE 1 = 2
      2  /
    Table created.
    scott@ORA92> DECLARE
      2    TYPE WEEK_NUM_T     IS VARRAY(10) OF VARCHAR2(10);
      3    vc_weeknum WEEK_NUM_T;
      4  BEGIN
      5    SELECT DISTINCT deptno
      6    BULK   COLLECT INTO vc_weeknum
      7    FROM   emp;
      8 
      9    INSERT INTO TMP_HOLD
    10    SELECT *
    11    FROM   dept
    12    WHERE  deptno IN
    13             (SELECT * FROM TABLE(vc_weeknum));
    14  END;
    15  /
             (SELECT * FROM TABLE(vc_weeknum));
    ERROR at line 13:
    ORA-06550: line 13, column 31:
    PLS-00642: local collection types not allowed in SQL statements
    ORA-06550: line 13, column 25:
    PL/SQL: ORA-22905: cannot access rows from a non-nested table item
    ORA-06550: line 9, column 3:
    PL/SQL: SQL Statement ignored
    -- correction:
    scott@ORA92> CREATE OR REPLACE TYPE WEEK_NUM_T AS TABLE OF VARCHAR2(10);
      2  /
    Type created.
    scott@ORA92> DECLARE
      2    vc_weeknum WEEK_NUM_T;
      3  BEGIN
      4    SELECT DISTINCT deptno
      5    BULK   COLLECT INTO vc_weeknum
      6    FROM   emp;
      7 
      8    INSERT INTO TMP_HOLD
      9    SELECT *
    10    FROM   dept
    11    WHERE  deptno IN
    12             (SELECT * FROM TABLE (CAST (vc_weeknum AS week_num_t)));
    13  END;
    14  /
    PL/SQL procedure successfully completed.
    scott@ORA92> SELECT * FROM tmp_hold
      2  /
        DEPTNO DNAME          LOC
            10 ACCOUNTING     NEW YORK
            20 RESEARCH       DALLAS
            30 SALES          CHICAGO
    scott@ORA92>

  • Message no. AK005 - Asset is investment measure, transaction type not allow

    Dear All,
    I am getting following error while transfering Investment AuC to Main Asset.
    Message no. AK005 - Asset is investment measure, transaction type not allow
    I searched the Forum and got some input.., but in that I have a clarification.
    Please see my doubt and the forum input.
    Internal Order as Investment Measure:
    Can you explain me Step 10. Settle the amounts to Main Asset from AuC(Prcg type: Full) - KO88 once again.
    How we can give the Receiver Main Asset master in KO88. In KO88 we can only provide the Internal Order. But that Internal Order is already settled to AuC in Step 8.
    Please guide me.
    Thanks.
    Regards,
    nms
    Re: Settlement of cost center to final asset ?
    Posted: Oct 27, 2009 11:40 AM
    Hi,
    Are you doing any settlement using the AUC asset ?
    Normal practice is to Create an Auc Asset and settle cost to Auc. Once the asset is ready for use, finally settle the Auc to final asset.
    This can be done in two ways like - line item settlement / investment measure.
    Below are steps in two scenarios :
    Internal Order as Investment Measure:
    1. Define the AuC Asset Class (with investment measure) - OAOA
    2. Define the Asset Class u2013 for Main Asset - OAOA
    3. Define Investment Profile - OITA
    a. Assign the AuC Asset Class (Step-1) in the investment profile
    4. Assign Investment Profile to Model Order - OITA
    5. Define Order Type (Investment) - KOT2
    a. Settlement Profile - OKO7
    b. Maintain Allocation Structures - OKO6
    c. Planning Profile - OKOS
    d. Budget Profile - OKOB
    6. Create an Internal Order - KO01
    a. With the Investment Profile (Step-2)
    b. AuC automatically created by the system using Asset Class given in the Investment Profile
    7. Post the amounts to IO - FB01
    8. Settle the amounts to AuC from IO (Prcg type: Automatic) - KO88
    9. Create the Main Asset - AS01
    10. Settle the amounts to Main Asset from AuC(Prcg type: Full) - KO88
    AuC using Line Item Settlement:
    1. Define the AuC Asset Class (with Line Item Settlement) - OAOA
    2. Define the Asset Class u2013 for Main Asset - OAOA
    3. Define Order Type (Overhead) - KOT2
    4. Create an AuC-Asset (using Step-1 Asset Class) - AS01
    5. Create an Internal Order - KO01
    a. Assign the AuC u2013 Asset in Settlement Rule in IO
    6. Post the amounts to IO - FB01
    7. Settle the amounts to AuC from IO - KO88
    8. Create Main Asset (using Step-2 Asset Class) - AS01
    9. Assign the Main Asset in IO (Step-5) - KO02
    10. Settlement AuC u2013 Line Item List - AIAB
    11. Settlement AuC - Receiver - AIBU
    VVR

    nms,
    Your message is not very clear - while you have mentioned at what stage are you getting the above-mentioned error message, you haven't mentioned exactly what you were trying to do. The fact that you are getting this error is a straight-forward indication that you are attempting to do something that SAP does expect.
    However, answering your query about how to use KO88, you have to settle the AuC to a FA (fixed asset, with asset class other than AuC ), as that will close the open AuC, transfer the value from the AuC to the FA and from this point onwards, all transactions will happen to this FA. Your statement "in KO88, we can only provide the Internal Order" is incorrect.
    Hope this helps.
    Regards
    Gulshan

  • ESS Business Package Error: Period type not allowed for profile ESS

    Hi,
    We are trying to configure the business package for Employee Self Service on Enterprise Portal 6.0. We followed this SDN contribution <a href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/21eb036a-0a01-0010-25a3-b2224432640a">ESS doc guide</a>
    So far we have successfully deployed the business packages and followed all the configurations that were pointed out in the doc guide. Unfortunately when we try to access the Employee Self-Service portal pages (Overview, Employee Search, etc), we encounter this error:
    Critical Error:
    Period type not allowed for profile ESS, error key: RFC_ERROR_SYSTEM_FAILURE
    com.sap.tc.webdynpro.modelimpl.dynamicrfc.WDDynamicRFCExecuteException:      Period type not allowed for profile ESS, error key: RFC_ERROR_SYSTEM_FAILURE
    Any ideas on how to fix this issue?
    Regards,
    Jojo

    Hi Jojo,
    Have you solved the problem? If yes can you please help me even I am facing the same error.
    this is very help full to me .
    Thanks and Regards,
    Shilpi.

  • Reg: PLS-00418: array bind type must match PL/SQL table row type error

    I am trying to access a table of records through JDBC OracleCallableStatement. I am able to do it fine for all mappings except for the ones below
    TYPE CAT_CD_TYPE IS TABLE OF A.B %TYPE INDEX BY BINARY_INTEGER;
    TYPE ORG_CD_TYPE IS TABLE OF C.D %TYPE INDEX BY BINARY_INTEGER;
    Column B is CHAR(1) and Column D is CHAR(2). I am trying to register the out parameters of Oraclecallablestatement as
    cstmt.registerIndexTableOutParameter(2, 2000, OracleTypes.CHAR, 0);
    cstmt.registerIndexTableOutParameter(3, 2000, OracleTypes.CHAR, 0);
    All the other mappings work fine. These two fail with the error
    SQLException in invokeDBPackage() : ORA-06550: line 1, column 32:
    PLS-00418: array bind type must match PL/SQL table row type
    ORA-06550: line 1, column 35:
    PLS-00418: array bind type must match PL/SQL table row type
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    I tried other OracleTypes mappings too but no luck so far.
    Any advice on this would be greatly appreciated.

    Hi,
    I'm not sure it's reasonable to expect someone to sift through that much stuff.
    Which parameter is it having a problem with?
    Can you modify the following to reproduce the behavior?
    Thanks
    Greg
    create package mypack5 as
    TYPE v2array is table of emp.ename%type index by BINARY_INTEGER;
    PROCEDURE test_it(thearray IN v2array, numrecs out number);
    END;
    CREATE or replace PACKAGE BODY MYPACK5 AS
    PROCEDURE test_it(thearray IN v2array, numrecs out number)
    IS
    begin
    numrecs := thearray.count;
    END;
    END;
    using System;
    using System.Data;
    using Oracle.DataAccess.Client;
    public class indexby
    public static void Main()
    OracleConnection con = new OracleConnection("data source=orcl;user id=scott;password=tiger;");
    con.Open();
    OracleCommand cmd = new OracleCommand("mypack5.test_it", con);
    cmd.CommandType = CommandType.StoredProcedure;
    OracleParameter Param1 = cmd.Parameters.Add("param1", OracleDbType.Varchar2);
    Param1.Direction = ParameterDirection.Input;
    Param1.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
    Param1.Size = 3;
    string[] vals = { "foo", "bar", "baz" };
    Param1.Value = vals;
    OracleParameter Param2 = cmd.Parameters.Add("param2", OracleDbType.Int32, DBNull.Value, ParameterDirection.Output);
    cmd.ExecuteNonQuery();
    Console.WriteLine("{0} records passed in", Param2.Value);
    con.Close();
    }

  • PLS-00418: array bind type must match PL/SQL table row type

    If a PL/SQL table is indexed by CHAR and is a parameter
    in a Stored Program, we are not able to call the stored
    program from the Java code.
    We get the following error code.
    java.sql.SQLException: ORA-06550: line 1, column 62:
    PLS-00418: array bind type must match PL/SQL table row type
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    But if we change the CHAR into VARCHAR2 then it works.
    We are using Oracle9i Enterprise Edition Release 9.2.0.5.0 -64bit Production ,
    JServer Release 9.2.0.5.0 - Production
    and JDK1.4.
    Thanks
    Push..

    Hi,
    I'm not sure it's reasonable to expect someone to sift through that much stuff.
    Which parameter is it having a problem with?
    Can you modify the following to reproduce the behavior?
    Thanks
    Greg
    create package mypack5 as
    TYPE v2array is table of emp.ename%type index by BINARY_INTEGER;
    PROCEDURE test_it(thearray IN v2array, numrecs out number);
    END;
    CREATE or replace PACKAGE BODY MYPACK5 AS
    PROCEDURE test_it(thearray IN v2array, numrecs out number)
    IS
    begin
    numrecs := thearray.count;
    END;
    END;
    using System;
    using System.Data;
    using Oracle.DataAccess.Client;
    public class indexby
    public static void Main()
    OracleConnection con = new OracleConnection("data source=orcl;user id=scott;password=tiger;");
    con.Open();
    OracleCommand cmd = new OracleCommand("mypack5.test_it", con);
    cmd.CommandType = CommandType.StoredProcedure;
    OracleParameter Param1 = cmd.Parameters.Add("param1", OracleDbType.Varchar2);
    Param1.Direction = ParameterDirection.Input;
    Param1.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
    Param1.Size = 3;
    string[] vals = { "foo", "bar", "baz" };
    Param1.Value = vals;
    OracleParameter Param2 = cmd.Parameters.Add("param2", OracleDbType.Int32, DBNull.Value, ParameterDirection.Output);
    cmd.ExecuteNonQuery();
    Console.WriteLine("{0} records passed in", Param2.Value);
    con.Close();
    }

  • SET CHAINED command not allowed within multi-statement transaction

    Hi,
    i need to do one transaction and i am setting autocommit(false) and
    once i am don ewith my 2 inserts i am settins it to true.
    i have like 20 thousand rows and when it is working fine for some inserts but after that it is throwing
    "SET CHAINED command not allowed within multi-statement transaction".
    can anyone please help me.

    You can find some information here:
    http://publib.boulder.ibm.com/infocenter/wsphelp/index.jsp?topic=/com.ibm.websphere.nd.doc/info/ae/ae/rtrb_dsaccess.html
    it's first problem for sybase DB

  • Sybase:  SET CHAINED command not allowed within multi-statement transaction

    Hello,
    I'm getting the error message "SET CHAINED command not allowed within
    multi-statement transaction" for CMP Entity beans against Sybase.
    The errors appear in my jdbc.log in this order:
    010SM: This database does not support the initial proposed set of
    capabilities, retrying.) SQLState(010SM)
    JZ0EM: End of data.
    JZ0SJ: Metadata accessor information was not found on this database.
    Please install the required tables
    as mentioned in the jConnect documentation.
    010SL: Out-of-date metadata accessor information was found on this
    database. Ask your database administrat
    or to load the latest scripts.) SQLState(010SL)
    SQLState(ZZZZZ) vendor code(226)
    com.sybase.jdbc2.jdbc.SybSQLException: SET CHAINED command not allowed
    within multi-statement transaction.
    I'm using JConnect 5.5, WebLogic 6.1 sp3, Solaris 8, and Sybase 11.
    The weird thing is, the app works on a box running 6.1 sp2 and Win2k
    Prof.
    Any ideas?
    Thanks!
    Dan

    Hi Dan,
    There is a patch for this sybase problem, please contact [email protected] to
    get a temp patch.
    sree
    "Dan Blaner" <[email protected]> wrote in message
    news:[email protected]..
    Hello,
    I'm getting the error message "SET CHAINED command not allowed within
    multi-statement transaction" for CMP Entity beans against Sybase.
    The errors appear in my jdbc.log in this order:
    010SM: This database does not support the initial proposed set of
    capabilities, retrying.) SQLState(010SM)
    JZ0EM: End of data.
    JZ0SJ: Metadata accessor information was not found on this database.
    Please install the required tables
    as mentioned in the jConnect documentation.
    010SL: Out-of-date metadata accessor information was found on this
    database. Ask your database administrat
    or to load the latest scripts.) SQLState(010SL)
    SQLState(ZZZZZ) vendor code(226)
    com.sybase.jdbc2.jdbc.SybSQLException: SET CHAINED command not allowed
    within multi-statement transaction.
    I'm using JConnect 5.5, WebLogic 6.1 sp3, Solaris 8, and Sybase 11.
    The weird thing is, the app works on a box running 6.1 sp2 and Win2k
    Prof.
    Any ideas?
    Thanks!
    Dan

  • Parameter not accessible in SQL statement

    Hello
    I am assigning value to 2 parameters on the form (PARAMETER node)
    :parameter.p1:=5;
    :parameter.p2:='AAA';
    p1 is of number type and p2 is of char type.
    now i want to query as follows
    select count(*) from AA_table where id=:parameter.p1 and name=:parameter.p2;
    this statement return count=0, which is wrong. actual count is 1.
    why param values are not taken in SQL statement, as i display values of parameters using message(), it shows the values properly.....
    plzzzzzz..... help.......

    parameter datatype by default is char. So I doubt though you assign 5 to p1 it considers as a character.
    Try below
    select count(*) from AA_table where id=to_number(:parameter.p1) and name=:parameter.p2;
    or change the data type to number for p1
    Rajesh Alex

  • Subquery not allowed - PL/SQL Function Body returning bolean

    Is subquery is not allowed in PL/SQL Expresion.????
    I am using the following query in one of my derived report column but I am getting the error.
    BEGIN
    if :COL1<>'abc' and :COL2 in (select deptno from dept1) then
    return 1;
    elsif :COL1<>'abc' and :COL2 in (select deptno from dept2) then
    return 0;
    elsif :COL1<>'abc' and :COL2 in (select deptno from dept3) then
    return 1;
    else
    return 0;
    end if;
    END;
    secondly CAN I use return value such as 'ABC' or 'XYZ' other than 0,1.
    Error-
    Invalid function body condition: ORA-06550: line 4, column 8: PLS-00405: subquery not allowed in this context ORA-06550: line 2, column 3: PL/SQL: Statement ignored
    -----------------

    Hi Deepak,
    There are at least methods.
    1 - You could create a SQL function that returned 0 or 1 and use that in your statement
    2 - You could use a CASE clause in the SQL statement
    As I don't have your dept1/2/3 tables, I've tried the following on the sample EMP/DEPT tables:
    SELECT EMPNO,
    ENAME,
    SAL,
    COMM,
    DEPTNO,
    CASE WHEN DEPTNO IN (SELECT DEPTNO FROM DEPT) THEN
      CASE WHEN ENAME LIKE '%A%' THEN NVL(SAL,0) + NVL(COMM,0) ELSE 456 END
    ELSE
       CASE WHEN DEPTNO NOT IN (SELECT DEPTNO FROM DEPT) THEN
         CASE WHEN ENAME LIKE '%A%' THEN NVL(SAL,0) + NVL(COMM,0) ELSE 123 END
       ELSE
         789
       END
    END "TOTAL"
    FROM EMPThis returns the values I expect:
    EMPNO     ENAME     SAL     COMM     DEPTNO     TOTAL
    7936     ATD     3000     -      40     3000
    7958     dino4     -      -      -      789
    7839     KINGS     5000     -      40     456
    7698     BLAKES     2850     -      30     2850
    7782     CLARK     2450     -      10     2450
    7566     JONES     2975     -      30     456
    7788     SCOTT     3000     -      20     456
    7902     FORD     3000     -      40     456
    7369     SMITH     800     -      20     456
    7499     ALLEN     1600     300     30     1900Obviously, you may have to experiment with the various CASE statements, but it will work using just a sql select statement.
    Andy

  • Data types not compatible with Sql Server 2012

    HI All,
    I need to know what are data types which were present in sql server 2005 but are not in sql server 2012.
    Regards
    Rahul

    Hi vaibhav
    Thanks for help. Actually my requirement is that I have one database on sql server 2005 version. I am planning to migrate it to sql server 2012 version. I want to publish a list of all objects across all databases which cannot be replicated to sql server
    2012.How can I do this. Are there any data types which were in sql 2005 version but are depreciated in sql server 2012
    Regards
    Rahul
    yes there are
    but why not look at here for breaking changes
    http://msdn.microsoft.com/en-us/library/ms143179(v=sql.110).aspx
    The deprecated features would still work though new development using them is discouraged
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Procedure not checking each sql statement.

    Hi All,
    I have created 2 tables names are A1 and B1. A1 table has some fields. Fields are no,sal,comm.,load_date. In A1 table NO (column) is the primary key.
    Second table is B1. this table has id,phone_no and load_date. In this table constraint
    ID column is the Not null.
    After that I have created 2 procedures one for A1 and one for B1. with in those procedures I used SQL insert statements.
    In procedures I used some valid sql statements and some invalid statements ( invalid statements means that I have specified constraint that’s why I specified duplicated and null values). While executing the procedures procedure shows error because of invalid statement and in that procedures I did not specify any Exceptions.
    If I specify Exceptions in procedures executing successfully some records are not loading procedure is comeing out. How do we mention server needs to be check and every insert sql startement.
    EX:
    If I give 6 records from 1 to 3 valid statements. I mentioned 4 th record copy of previos record( duplicated). 5 th record and 6 th valid records.
    Procedure executing successfully. Procedure loaded 1 to 4 records after that not loaded 5,6 and 7 records. How do we specify for record inserts 7. actually 7 th record is valid statement we should be insert this record. Please tell me how do we handle sql statements each and every one successfully or not.
    create or replace procedure a_proc as
    --declare
    begin
    insert into a1 values (100,2000,300,sysdate);
    insert into a1 values(200,1000,400,sysdate);
    insert into a1 values(300,3000,500,sysdate);
    insert into a1 values(400,6000,600,sysdate);
    insert into a1 values(400,900,700,sysdate);
    insert into a1 values(400,10000,1200,sysdate);
    insert into a1 values(900,11000,1300,sysdate);
    commit;
    EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE('ERROR - '||sqlerrm);
    end a_proc;
    In B1 table colums are ID,PHONE_NO and Load_date. ID is not null column.
    For B1 population I have created one procedure
    create or replace procedure b_proc as
    --declare
    begin
    insert into b1 values(1,123456,sysdate); -- 1 record
    insert into b1 (phone_no,load_date) values (7896538,sysdate); --2 record
    insert into b1 (phone_no) values(6763723458); ----3 record
    insert into b1 (phone_no) values(453465778); --4 record
    insert into b1 values(400,72894894,sysdate); --5 record
    insert into b1 values(500,72894894,sysdate); --6 record
    commit;
    EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE('ERROR - '||sqlerrm);
    end b_proc;
    if I execute above procedure procedure executing successfully but procedure inserting only first record not inserting 5th and 6th record. How do we exception for 5th and 6th records also.
    Thanks and Regards,
    Venkat

    {color:#808080}{color:#333300}Hi,
    Please find answer to your question below:{color}
    Venkat: Procedure executing successfully. Procedure loaded 1 to 4 records after that not loaded 5,6 and 7 records. How do we specify for record inserts 7. actually 7 th record is valid statement we should be insert this record. Please tell me how do we handle sql statements each and every one successfully or not.
    {color}
    {color:#0000ff}Guna: The procedure hits an exception after 4th record, and does not process anymore as it exits out of the procedure, I believe the data is not committed as well. You need handle exceptions if the processing has to continue. Same is the belwo case as well
    {color}{color:#333300}Regards,
    Guna{color}

  • NOT A VALID SQL STATEMENT EUL-3587

    I 've put the following SQL statement in a custom folder but the admin edition does not accept it. Could anyone tell me why??
    I kee getting the message from the subject.
    I am using version; 4.1.48.06.00 on Windows XP
    Greetz
    Eelco
    SELECT DECODE ((TRUNC(SYSDATE- gis_notas.nota_verzend_dat)),
    LEAST((TRUNC(SYSDATE- gis_notas.nota_verzend_dat)), 39), '0 t/m 39',
    LEAST((TRUNC(SYSDATE- gis_notas.nota_verzend_dat)), 60), '40 t/m 60',
    LEAST((TRUNC(SYSDATE- gis_notas.nota_verzend_dat)), 90), '61 t/m 90',
    LEAST((TRUNC(SYSDATE- gis_notas.nota_verzend_dat)), 120), '91 t/m 120','> 120'),
    gis_notas.odg_volgnum,
    gis_notas.DEBITEURNUM,
    gis_notas.NOTA_NUM,
    gis_debiteuren_og.INC_STATUS,
    gis_notas.BEDRAG,
    gis_notas.OPENSTAAND_BDG,
    SUM (gis_notas.openstaand_bdg)
    FROM gis_debiteuren_og gis_debiteuren_og,
    gis_notas gis_notas
    WHERE ((gis_debiteuren_og.odg_volgnum = gis_notas.odg_volgnum
    AND gis_debiteuren_og.debiteurnum = gis_notas.debiteurnum
    AND gis_debiteuren_og.externe_bron = gis_notas.externe_bron
    AND gis_debiteuren_og.srt_externe_code = gis_notas.srt_externe_code))
    AND (gis_debiteuren_og.inc_status in ('INV'))
    AND (gis_notas.openstaand_bdg <> 0)
    AND (gis_debiteuren_og.odg_volgnum IN (1))
    AND LEAST((TRUNC(SYSDATE- gis_notas.nota_verzend_dat)), 60) is not null
    GROUP BY DECODE ((TRUNC(SYSDATE- gis_notas.nota_verzend_dat)),
    LEAST((TRUNC(SYSDATE- gis_notas.nota_verzend_dat)), 39), '0 t/m 39',
    LEAST((TRUNC(SYSDATE- gis_notas.nota_verzend_dat)), 60), '40 t/m 60',
    LEAST((TRUNC(SYSDATE- gis_notas.nota_verzend_dat)), 90), '61 t/m 90',
    LEAST((TRUNC(SYSDATE- gis_notas.nota_verzend_dat)), 120), '91 t/m 120','> 120'),
    gis_notas.odg_volgnum,
    gis_notas.DEBITEURNUM,
    gis_notas.NOTA_NUM,
    gis_notas.BEDRAG,
    gis_notas.OPENSTAAND_BDG,
    gis_debiteuren_og.INC_STATUS

    Hi,
    Try using an alias for you all your calculated columns, e.g.
    SUM (gis_notas.openstaand_bdg) SUM_OPENSTAAND_BDG
    Hope that helps,
    Rod West

  • Just a helpful SAP note for slow SQL statements

    Hi Guys,
    Just wanted to share this SAP note with you. I am sure many of you might have gone through it.
    [SAP Note 155413 - Analysis of slow SQL statements|https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=155413]
    Cheers,
    Abu

    >
    ZAFCO ABAP wrote:
    > Hi Guys,
    >
    > Just wanted to share this SAP note with you. I am sure many of you might have gone through it.
    >
    > [SAP Note 155413 - Analysis of slow SQL statements|https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=155413]
    >
    > Cheers,
    > Abu
    Hi,
    I would bet not as many as you might think -  many questions here suffering form not GOING through
    the analysis before they post it here. 
    Meantime I think questions to SQL statement performance here will only be answered when the execution plan on the statement  is posted with it.
    bye
    yk

  • Value types not allowed in Collections classes?

    When I tried to instantiate a TreeMap< int, Object >, I received a compile error. I searched the Collections documentation but didn't see any explanation of why this sort of thing isn't allowed. I realize I can use an Integer object, but it just seems inefficient to have to construct a new Integer every time I want to search the container (which will be extremely frequent in this particular situation).

    For collections, int doesn't define methods like compareTo or hashCode, so each combination of primitives would have to be implemented as a special case. I just found a library that seems to do this: http://fastutil.dsi.unimi.it/.
    Got it. And by the way, the fastutil library looks to be exactly what I need. Thanks for the link.
    BTW, if you have Java 1.5 or later (i think) it has a feature called autoboxing which automagically converts primitives to their wrapper class and back again.That's what I'm currently using, but I just wanted to avoid the overhead of repeatedly creating an Integer object (in porting the application from C++ to Java I've noticed some degradation in speed, and so I'm cutting corners wherever possible).

Maybe you are looking for