PL/SQL code problem for LOV

Hi,
I have developed an application using Apex 4.0
Now, i am trying to make a LOV for two columns in my table. Say column A and column B.
Column A has four different values under it say x,y,z,w and column B has around 3 different values say 1,2 and 3.
How do i write a code for LOV for A and B.
SO that it shows me a drop down list for each and then display results accordingly.
Thanks

user13280446 (mind setting your name?),
The fix for this error is to find the subquery in your SQL that's returning more than one row; generally, you'll want to fix the subquery to return only one row, though in some rare situations it's appropriate to change an = to an in clause.
Example:
select *
from a_table a
where a.col1 = ( select b.col1
                 from b_table b
                 where b.col2 = 42 );Unless b.col2 is guaranteed to be unique (either PK or enforced through a unique constraint), sooner or later that subquery is going to return more than one row, producing the error you're seeing. These variations will all avoid this, though which one (if any) is/are correct is dependent on the data:
select *
from a_table a
where a.col1 = ( select min(b.col1) -- Ensure one row returned
                 from b_table b
                 where b.col2 = 42 );
select *
from a_table a
where a.col1 in ( select b.col1
                 from b_table b
                 where b.col2 = 42 );
select a.*
from a_table a,
    b_table b
where a.col1 = b.col1
    and b.col2 = 42;This is a very contrived example, of course, but without seeing the SQL for your LOV, we can't be any more specific than that...
-David

Similar Messages

  • Sql code problem

    for example:
    update vv_om_temp_tl t
    set t.inventory_item_id =(select attribute6 from mtl_system_items_b
    where inventory_item_id = t.inventory_item_id
    and organization_id = p_organization_id)
    where exists
    (select 'X'
    from oe_order_lines_all ol
    where ol.price_list_id in (8118,8119)
    and ol.line_id = t.order_line_id);
    above example update table (vv_om_temp_tl ) through update function while i want to make the same result using one sql code.
    who can help me?
    thanks!

    select decode( t.inventory_item_id,...................) inventory_item_id
    from vv_om_temp_tl t,
    mtl_system_items_b b,
    where t.inventory_item_id = b.inventory_item_id
    how to write that pl/sql code?

  • AM extension:Problem in Lov.

    Hi Experts,
    I did an extension for the Main AM of the page..After get extended except Lov's Everthing is working fine.
    Please let me know whats the problem for lov's after extend the AM.
    is there any solution to resolve this.
    Thanks
    Bharat Hegde

    Bharat,
    If you have done the .jpx import you have to remove the VO substitution
    Can be done in two ways,
    1) replace the VO path with your VO
    begin
    jdr_utils.listCustomizations('/oracle/apps/eam/requests/server/RequestResultsVO');
    end;
    begin
    jdr_utils.printDocument('the above qry output');
    end;
    Which will display your substitution VO details,this is to confirm
    begin
    jdr_utils.deleteDocument('<enter your VO with customization path, make sure you are not enteriing the standard VO>');
    end;
    do a commit;
    After you run the delete script , Run the above listcustomization script to confirm ur subs is deleted.
    2) And you can try via
    Functionalional Administrator(responsibility) -> Personalization->Import/Export -> Personalization Repository
    Query for the Document Path /oracle/apps/eam/requests/server/
    You should see ur custom ,delete from there.
    Thanks.
    With Regards,
    Kali.
    OSSi.

  • View the SQL code

    Hello,
    I'd really like to see the SQL code generated for a webi request in XI version 3.0. Could you help me please ?
    In webi XI R2, you have a little button "i"sql that open the windows with the code (from the request) ; I find this functionality quite practical to look for a bug !
    Thank you for your answer,
    Regards,
    Camille

    Hi Camille,
    If it is built over a Relational DB eg Oracle and you have the permission granted then you should be able to see the SQL Viewer button.
    If your universe is connecting to a OLAP Cube, SAP BEx query or anyother data source based on MDX then it will not be available.
    If this is not the case for you I would report it as a bug.
    Regards
    Alan

  • SQL Code Output

    Hello All,
    Does anyone know if it possible to get SQL code ouput for the rules resulting from clustering?
    Thanks,
    Alan

    I'm still not sure that I understand what you are doing...
    You're using SQL Developer. Are you using Oracle Data Mining? Unfortunately, Oracle the corporation and Oracle the database use the term "cluster" in a lot of different places so it has a lot of potential meanings. It sounds like you're trying to run a clustering algorithm using Oracle Data Miner on a sample data set.
    If that's the case, you probably want to post this over in the Data Mining
    Justin

  • Can I have a PL/SQL code for LOV

    Hi,
    I apologize for this dumb question. I have been so out of touch with dev (almost 8 years). Plus new to pl/sql.
    I am creating a status report application. On the dashboard, I currently have some metrics (horizontal charts). I wanted to expose these metrics based on filter.
    I had created 2 filters. The first one will identify the type (Week, Month, Qtr or Year) and the 2nd filter would be based on the type. For e.g. if I select Month as type, the 2nd filter should show May-12, April-12 etc. Once I select the 2nd filter, I should use them to show the appropriate metrics. The metric that I currently have would show all the projects that users have worked on during the week/month/qtr or year (depending on the 1st and 2nd filter).
    On the dashboard region, I added a condition to check if the value for both 1st and 2nd filter is not null. This allows me to show the dashboard only if the 2 filters have been selected.
    For the 2nd filter, I need to write a PL/SQL code to show the LOV.
    I am assuming that the pl/sql would return a SQL query. The SQL query will be based on week, month etc. Is that right?
    Thanks
    balaji
    Edited by: user644868 on May 17, 2012 11:29 AM

    rbalaji2026 wrote:
    For the 2nd filter, I need to write a PL/SQL code to show the LOV. Doesn't appear necessary. With filter 2 cascading from filter 1, why not:
    select
            /* Week query */
    from
    where
    and     :p1_filter_1 = 'WEEK'       
    union all
    select
            /* Month query */
    from
    where
    and     :p1_filter_1 = 'MONTH'       
    union all
    select
            /* Quarter query */
    from
    where
    and     :p1_filter_1 = 'QUARTER'       
    union all
    select
            /* Year query */
    from
    where
    and     :p1_filter_1 = 'YEAR'       

  • Problem compiling PL/SQL code

    I am having problmes compiling the following piece of pl/sql
    code:
    declare
    v_servicekey services.servicekey%type;
    v_tmodelkey tmodels.tmodelkey%type;
    l_bindingid bindingtemplates.bindingid%type;
    i_rowlimit number(28);
    begin
    select bindingid
    into l_bindingid
    from
    (select b.bindingid as bindingid,
    b.bindingkey,
    nvl(b.accesspointurltype,''),
    nvl(b.accesspointurl,''),
    nvl(b.hostingredirector,''),
    b.updated
    from bindingtemplates b, services s
    where s.serviceid=b.serviceid
    and s.servicekey=v_servicekey
    and (b.bindingid in (select i.bindingid
    from instances
    i,tmodels t
    where
    t.tmodelid=i.tmodelid
    and
    t.tmodelkey=v_tmodelkey)
    or (b.hostingredirector is not
    null
    and b.hostingredirector in
    (select bindingkey
    from bindingtemplates
    where bindingid in (select i.bindingid
    from instances i,tmodels t
    where t.tmodelid = i.tmodelid
    and t.tmodelkey = v_tmodelkey))))
    order by b.updated)
    where rownum <= i_rowlimit;
    end;
    I get the compilation error
    ERROR at line 30:
    ORA-06550: line 30, column 27:
    PLS-00103: Encountered the symbol "ORDER" when expecting one of
    the following:
    ) * & = - + < / > in mod not rem with an exponent (**)
    <> or != or ~= >= <= <> and or like between group having
    intersect minus start union where connect is null is not ||
    is dangling year DAY_
    The symbol ")" was substituted for "ORDER" to continue.
    ORA-06550: line 30, column 45:
    PLS-00103: Encountered the symbol ")" when expecting one of the
    following:
    . ( , * @ % & - + ; / for mod rem an exponent (**) asc desc
    ||
    Obviously there is only one SQL and it is complaining about the
    ORDER BY clause. Please ignore the values for the host variables.
    The same SQL when run from the SQL prompt with values
    substituted for the host variables runs perfectly well. Am I
    missing something or is there a catch with Oracle PL/SQL.
    Please enlighten.
    Thanks

    see
    http://forums.oracle.com/forums/message.jsp?id=500260
    I want to know that if there is any PL/SQL commad for compiling the code?
    My problem is, I am working in an environment where we are using a Database tool named TOAD of QUEST Software. Every body can look into the code. I just want to hide this code from others. A Quick reply in this regard will be really very helpful.

  • Explain plans for PL/SQL code?

    Hi!
    I am pulling SQL statements (select, insert, update, delete, etc.) from PL/SQL code and producing explain plans. Some of the delete statements have "WHERE CURRENT OF" in them which produces an ORA-3001 error (feature not implemented) error. How can I do an explain plan of these statements? Can I replace "WHERE CURRENT OF" with "=" to get a plan? How far off will the plan be? Any suggestions, ideas, etc. greatfully appreciated!
    This is Oracle 9.2.0.4/5 on AIX if it makes a difference.
    Thanks!
    Dave Venus

    WHERE CURRENT OF shouldn't be a problem. Here above an example on 9.2.0.4 on AIX5.2 :
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.4.0 - Production
    SQL> create table TBL_USER_PROFILE_CATEGORY
      2  as
      3  select 654 id_category, 1103 id_user from dual union all
      4  select 654 id_category, 1104 id_user from dual union all
      5  select 18  id_category, 1103 id_user from dual union all
      6  select 629 id_category, 1103 id_user from dual union all
      7  select 110 id_category, 1103 id_user from dual union all
      8  select 110 id_category, 1104 id_user from dual union all
      9  select 18  id_category, 1104 id_user from dual union all
    10  select 37  id_category, 1103 id_user from dual union all
    11  select 24  id_category, 1103 id_user from dual union all
    12  select 7   id_category, 104  id_user from dual union all
    13  select 37  id_category, 1104 id_user from dual union all
    14  select 22  id_category, 1103 id_user from dual union all
    15  select 22  id_category, 1104 id_user from dual union all
    16  select 25  id_category, 1104 id_user from dual union all
    17  select 25  id_category, 1103 id_user from dual ;
    Table created.
    SQL>
    SQL> alter table TBL_USER_PROFILE_CATEGORY add primary key (id_category, id_use
    Table altered.
    SQL>
    SQL> CREATE OR REPLACE
      2  PROCEDURE P$UPDATE_TBL_USER_PROFILE_CAT(p_id_cat_old IN NUMBER) AS
      3    p_id_category number;
      4    p_id_user     number;
      5    cursor mycur is select id_category, id_user
      6                    from TBL_USER_PROFILE_CATEGORY
      7                    where  id_category = p_id_cat_old
      8                    for update of id_category;
      9  BEGIN
    10    open mycur;
    11    LOOP
    12       FETCH mycur INTO p_id_category, p_id_user;
    13       EXIT WHEN mycur%NOTFOUND;
    14       BEGIN
    15 DELETE FROM TBL_USER_PROFILE_CATEGORY
    16 WHERE CURRENT OF mycur;
    17       END;
    18     END LOOP;
    19     CLOSE mycur;
    20     COMMIT;
    21  EXCEPTION WHEN OTHERS THEN rollback;
    22  END;
    23  /
    Procedure created.
    SQL>
    SQL> exec P$UPDATE_TBL_USER_PROFILE_CAT(654)
    PL/SQL procedure successfully completed.
    SQL> select * from TBL_USER_PROFILE_CATEGORY;
    ID_CATEGORY    ID_USER
             18       1103
            629       1103
            110       1103
            110       1104
             18       1104
             37       1103
             24       1103
              7        104
             37       1104
             22       1103
             22       1104
             25       1104
             25       1103
    13 rows selected.
    SQL> Please, paste here what's your code...
    Nicolas.

  • Problem for creation of PO for different company code

    I have problem for creation of PO using ME21 for different company code.Order is not created.
    Please give reply it is urgent.

    Hi Mansih,
    I don´t understand what is your exact problem, as I don´t see any company code being specified. But maybe you should check in XK03 that the vendor master data is created for this company code/purchasing organisation!
    Have a nice day!

  • I have a problem for download in app store . it shows error code : 1009

    i have a problem for download in app store . it shows error code : 1009

    https://discussions.apple.com/thread/2439043

  • Need PL/SQL code for this

    Hi,
    I need a PL/SQL code for this one...
    Let me know if something is not clear...
    1) The table CLOB_CLOBJECT_CDA has the columns described below...
    Explaining only those fields which are important in this context
    -- CDA_STEP_ID : Basically a Sequence
    -- CLOBJECT_SOURCE1_ID : Every id has got a set of records
    -- CLOBJECT_SOURCE2_ID : Every id has got a set of records
    -- LVL : There are total 8 levels..
    This is the main aim :
    1) There are total 16 million rows..(limited to 10 rows here)
    2) We need to go through level by level (LVL column) & insert the intersection records (CLOBJECT_SOURCE1_ID intersect CLOBJECT_SOURCE2_ID)
    into another table...but this is how it goes..
    Level (LVL column) 3's basically have CLOBJECT_SOURCE1_ID as level (LVL column) 2 CDA_STEP_ID's..
    (consider the statement --** where CLOBJECT_SOURCE1_ID = 285 which is same as 1st insert statement step id)..
    The above process goes for next levels until 8..(so have to use loops)
    So for ex :
    We go through the first insert statement and insert the insertion records only when both CLOBJECT_SOURCE1_ID & CLOBJECT_SOURCE2_ID has got records ..
    If we don't find any records for both of them we should skip the corresponding step id when we go to the next levels...
    Let's go through the 1st insert statement...
    -- We have CDA_STEP_ID = 285 & two sources CLOBJECT_SOURCE1_ID as 19 & CLOBJECT_SOURCE2_ID as 74...
    -- We see the table CLOBJECT_COUNTS & check whether we have counts for both 19 & 74 ..(In fact we insert counts into this table only if they have records)
    -- If so, we insert the intersection records into CDA_MRN_RESULTS ( we do have counts for both of them..) with CDA_STEP_ID 285...
    -- Then we insert the step id which is 285 along with the count into CLOBJECT_COUNTS..
    Let's go through another insert statement...
    -- Consider CDA_STEP_ID = 288 which has two sources CLOBJECT_SOURCE1_ID as 19 & CLOBJECT_SOURCE2_ID as 92...
    -- We see the table CLOBJECT_COUNTS & check whether we have counts for both 19 & 92 ..(we have records for 19 but not for 92)
    -- So we should not proceed with this..& also skip all those records (future records with increasing levels..basically level 3's) which have got 288 as CLOBJECT_SOURCE1_ID..
    (As said earlier that the present CDA_STEP_ID will always be CLOBJECT_SOURCE1_ID in the next level)...
    I wrote the following code which is after the statement...
    Let me have the create & insert statements here..
    create table CLOB_CLOBJECT_CDA
        CDA_STEP_ID           NUMBER,
        CDA_ID                NUMBER,
        CDA_SEQ_NUMBER        NUMBER,
        CLOBJECT_SOURCE1_TYPE VARCHAR2(3000),
        CLOBJECT_SOURCE1_ID   NUMBER,
        CLOBJECT_OPERATOR     VARCHAR2(3000),
        CLOBJECT_SOURCE2_TYPE VARCHAR2(3000),
        CLOBJECT_SOURCE2_ID   NUMBER,
        LVL                   NUMBER
    insert into clob_clobject_cda (CDA_STEP_ID, CDA_ID, CDA_SEQ_NUMBER, CLOBJECT_SOURCE1_TYPE, CLOBJECT_SOURCE1_ID, CLOBJECT_OPERATOR, CLOBJECT_SOURCE2_TYPE, CLOBJECT_SOURCE2_ID, LVL)
    values (285, 285, 1, 'CLOBJECT', 19, 'INTERSECT', 'CLOBJECT', 74, 2);
    insert into clob_clobject_cda (CDA_STEP_ID, CDA_ID, CDA_SEQ_NUMBER, CLOBJECT_SOURCE1_TYPE, CLOBJECT_SOURCE1_ID, CLOBJECT_OPERATOR, CLOBJECT_SOURCE2_TYPE, CLOBJECT_SOURCE2_ID, LVL)
    values (286, 286, 1, 'CLOBJECT', 19, 'INTERSECT', 'CLOBJECT', 75, 2);
    insert into clob_clobject_cda (CDA_STEP_ID, CDA_ID, CDA_SEQ_NUMBER, CLOBJECT_SOURCE1_TYPE, CLOBJECT_SOURCE1_ID, CLOBJECT_OPERATOR, CLOBJECT_SOURCE2_TYPE, CLOBJECT_SOURCE2_ID, LVL)
    values (287, 287, 1, 'CLOBJECT', 19, 'INTERSECT', 'CLOBJECT', 91, 2);
    insert into clob_clobject_cda (CDA_STEP_ID, CDA_ID, CDA_SEQ_NUMBER, CLOBJECT_SOURCE1_TYPE, CLOBJECT_SOURCE1_ID, CLOBJECT_OPERATOR, CLOBJECT_SOURCE2_TYPE, CLOBJECT_SOURCE2_ID, LVL)
    values (288, 288, 1, 'CLOBJECT', 19, 'INTERSECT', 'CLOBJECT', 92, 2);
    insert into clob_clobject_cda (CDA_STEP_ID, CDA_ID, CDA_SEQ_NUMBER, CLOBJECT_SOURCE1_TYPE, CLOBJECT_SOURCE1_ID, CLOBJECT_OPERATOR, CLOBJECT_SOURCE2_TYPE, CLOBJECT_SOURCE2_ID, LVL)
    values (4869, 4869, 1, 'CDA_STEP', 285, 'INTERSECT', 'CLOBJECT', 91, 3);  -- **
    insert into clob_clobject_cda (CDA_STEP_ID, CDA_ID, CDA_SEQ_NUMBER, CLOBJECT_SOURCE1_TYPE, CLOBJECT_SOURCE1_ID, CLOBJECT_OPERATOR, CLOBJECT_SOURCE2_TYPE, CLOBJECT_SOURCE2_ID, LVL)
    values (4870, 4870, 1, 'CDA_STEP', 285, 'INTERSECT', 'CLOBJECT', 92, 3);
    insert into clob_clobject_cda (CDA_STEP_ID, CDA_ID, CDA_SEQ_NUMBER, CLOBJECT_SOURCE1_TYPE, CLOBJECT_SOURCE1_ID, CLOBJECT_OPERATOR, CLOBJECT_SOURCE2_TYPE, CLOBJECT_SOURCE2_ID, LVL)
    values (4871, 4871, 1, 'CDA_STEP', 285, 'INTERSECT', 'CLOBJECT', 93, 3);
    insert into clob_clobject_cda (CDA_STEP_ID, CDA_ID, CDA_SEQ_NUMBER, CLOBJECT_SOURCE1_TYPE, CLOBJECT_SOURCE1_ID, CLOBJECT_OPERATOR, CLOBJECT_SOURCE2_TYPE, CLOBJECT_SOURCE2_ID, LVL)
    values (4880, 4880, 1, 'CDA_STEP', 286, 'INTERSECT', 'CLOBJECT', 91, 3);
    insert into clob_clobject_cda (CDA_STEP_ID, CDA_ID, CDA_SEQ_NUMBER, CLOBJECT_SOURCE1_TYPE, CLOBJECT_SOURCE1_ID, CLOBJECT_OPERATOR, CLOBJECT_SOURCE2_TYPE, CLOBJECT_SOURCE2_ID, LVL)
    values (4881, 4881, 1, 'CDA_STEP', 286, 'INTERSECT', 'CLOBJECT', 92, 3);
    insert into clob_clobject_cda (CDA_STEP_ID, CDA_ID, CDA_SEQ_NUMBER, CLOBJECT_SOURCE1_TYPE, CLOBJECT_SOURCE1_ID, CLOBJECT_OPERATOR, CLOBJECT_SOURCE2_TYPE, CLOBJECT_SOURCE2_ID, LVL)
    values (4882, 4882, 1, 'CDA_STEP', 286, 'INTERSECT', 'CLOBJECT', 93, 3);
    create table CDA_MRN_RESULTS
       CDA_STEP_ID      NUMBER,
      MRN              NUMBER,
      INSERT_DATE_TIME DATE
    insert into cda_mrn_results (CDA_STEP_ID, MRN, INSERT_DATE_TIME)
    values (19, 1, to_date('19-10-2011', 'dd-mm-yyyy'));
    insert into cda_mrn_results (CDA_STEP_ID, MRN, INSERT_DATE_TIME)
    values (19,  2, to_date('19-10-2011', 'dd-mm-yyyy'));
    insert into cda_mrn_results (CDA_STEP_ID, MRN, INSERT_DATE_TIME)
    values (19,  3, to_date('19-10-2011', 'dd-mm-yyyy'));
    insert into cda_mrn_results (CDA_STEP_ID, MRN, INSERT_DATE_TIME)
    values (74,  1, to_date('19-10-2011', 'dd-mm-yyyy'));
    insert into cda_mrn_results (CDA_STEP_ID, MRN, INSERT_DATE_TIME)
    values (74,  2, to_date('19-10-2011', 'dd-mm-yyyy'));
    insert into cda_mrn_results (CDA_STEP_ID, MRN, INSERT_DATE_TIME)
    values (74,  4, to_date('19-10-2011', 'dd-mm-yyyy'));
    insert into cda_mrn_results (CDA_STEP_ID, MRN, INSERT_DATE_TIME)
    values (75,  1, to_date('19-10-2011', 'dd-mm-yyyy'));
    insert into cda_mrn_results (CDA_STEP_ID, MRN, INSERT_DATE_TIME)
    values (75,  2, to_date('19-10-2011', 'dd-mm-yyyy'));
    insert into cda_mrn_results (CDA_STEP_ID, MRN, INSERT_DATE_TIME)
    values (75,  6, to_date('19-10-2011', 'dd-mm-yyyy'));
    insert into cda_mrn_results (CDA_STEP_ID, MRN, INSERT_DATE_TIME)
    values (91,  2, to_date('19-10-2011', 'dd-mm-yyyy'));
    insert into cda_mrn_results (CDA_STEP_ID, MRN, INSERT_DATE_TIME)
    values (91,  3, to_date('19-10-2011', 'dd-mm-yyyy'));
    create table CLOBJECT_COUNTS
      CDA_STEP_ID    NUMBER,
      CLOBJECT_COUNT NUMBER,
      DATE_TIME      DATE
    Insert into CLOBJECT_COUNTS values (19,3, to_date('19-10-2011', 'dd-mm-yyyy'));
    Insert into CLOBJECT_COUNTS values (74,3, to_date('19-10-2011', 'dd-mm-yyyy'));
    Insert into CLOBJECT_COUNTS values (75,3, to_date('19-10-2011', 'dd-mm-yyyy'));
    Insert into CLOBJECT_COUNTS values (91,2, to_date('19-10-2011', 'dd-mm-yyyy'));The output goes into two tables...
    CDA_MRN_RESULTS : O/p of intersection records between source1 & source2 id
    CLOBJECT_COUNTS : Step id with counts ...(useful for skipping next level step id's if either of source id has "0" counts)
    Any help is appreciated..
    Thanks..

    I tried to code this..but looping takes a lot of time..I want to skip certain rows where source1_step_id & source_2_step_id are not in clobject_counts table as we proceed to the next levels..Not sure how to skip the rows..
    declare
    cursor c1 (p_level varchar2 ) is
      Select * from clob_clobject_cda
        where lvl = p_level    ;
       TYPE V_TT IS TABLE OF C1%ROWTYPE INDEX BY PLS_INTEGER;
        L_TT V_TT;
        v1 number;
        v2 number;
        v_step_id number;
        v_operator varchar2(100) := '';
    begin
    for i in 2..8 loop
      open c1(i);
      LOOP
           FETCH C1 BULK COLLECT INTO L_TT LIMIT 500;
            FOR indx IN 1 .. L_TT.COUNT
             LOOP
               v1 := L_TT(indx).clobject_source1_id;
               v2 := L_TT(indx).clobject_source2_id;
               v_step_id := L_TT(indx).cda_step_id;
               v_operator := L_TT(indx).clobject_operator;
      Execute Immediate ('Insert into cda_mrn_results Select --+ parallel (cm 128)
                                                      distinct ' || v_step_id || ', mrn, trunc(sysdate) dt from cda_mrn_results  cm
                        where cda_step_id = ' || v1 || '
                        and   cda_step_id in (Select cda_step_id from clobject_counts) ' ||
         v_operator ||
                    '  Select --+ parallel (cm 128)
                                                      distinct ' || v_step_id || ', mrn, trunc(sysdate) dt from cda_mrn_results  cm
                        where cda_step_id = ' || v2 || '
                        and   cda_step_id in (Select cda_step_id from clobject_counts)  ' );
    Insert --+ Append
           into clobject_counts Select cda_step_id, count(distinct mrn),
                       insert_date_time dt from cda_mrn_results  where cda_step_id =  v_step_id   group by cda_step_id,insert_date_time;
       COMMIT;                    
             END LOOP;
           EXIT WHEN L_TT.COUNT = 0;
         END LOOP;
      CLOSE C1;
    End Loop;    
    Commit;
    End;

  • SQL*Loader problem - not efficient, parsing error for big xml files

    Hi Experts,
    First of all, I would like to store xml files in object relation way. Therefore I created a schema and a table for it (see above).
    I wants to propagate it (by using generated xml files), hence I created a control file for sql loader (see above).
    I have two problems for it.
    1, It takes a lot of time. It means I can upload a ~80MB file in 2 hours and a half.
    2, At bigger files, I got the following error messages (OCI-31011: XML parsing failed OCI-19202: Error occurred in XML processing LPX-00243: element attribute value must be enclosed in quotes). It is quite interesting because my xml file is generated and I could generated and uploaded the first and second half of the file.
    Can you help me to solve these problems?
    Thanks,
    Adam
    Control file
    UNRECOVERABLE
    LOAD DATA
    CHARACTERSET UTF8
    INFILE *
    APPEND
    INTO TABLE coll_xml_objrel
    XMLTYPE(xml)
    FIELDS
    ident constant 2
    ,file_name filler char(100)
    ,xml LOBFILE (file_name) TERMINATED BY EOF
    BEGINDATA
    generated1000x10000.xml
    Sql Loader command
    sqlldr.exe username/password@//localhost:1521/SID control='loader.ctl' log='loadr.log' direct=true
    Schema
    <?xml version="1.0" encoding="UTF-8"?>
    <schema targetNamespace="http://www.something.com/shema/simple_searches" elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.something.com/shema/simple_searches">
        <element name="searches" type="tns:searches_type"></element>
        <element name="search" type="tns:search_type"></element>
        <element name="results" type="tns:results_type"></element>
        <element name="result" type="tns:result_type"></element>
        <complexType name="searches_type">
            <sequence>
                <element ref="tns:search" maxOccurs="unbounded"></element>
            </sequence>
        </complexType>
        <complexType name="search_type">
            <sequence>
                <element ref="tns:results"></element>
            </sequence>
            <attribute ref="tns:id" use="required"></attribute>
            <attribute ref="tns:type" use="required"></attribute>
        </complexType>
        <complexType name="results_type">
            <sequence maxOccurs="unbounded">
                <element ref="tns:result"></element>
            </sequence>
        </complexType>
        <complexType name="result_type">
            <attribute ref="tns:id" use="required"></attribute>
        </complexType>
        <simpleType name="type_type">
            <restriction base="string">
                <enumeration value="value1"></enumeration>
                <enumeration value="value2"></enumeration>
            </restriction>
        </simpleType>
        <attribute name="type" type="tns:type_type"></attribute>
        <attribute name="id" type="string"></attribute>
    </schema>
    Create table
    create table coll_xml_objrel
    ident Number(20) primary key,
    xml xmltype)
    Xmltype column xml
    store as object relational
    xmlschema "http://www.something.com/schema/simple_searches.xsd"
    Element "searches";

    Hi Odie_63,
    Thanks for your answer.
    I will post this question in the XML DB forum too (edit: I realized that you have done it. Thanks for it).
    1, Version: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    2, see above
    3, I have registered my schema with using dbms_xmlschema.registerSchema function.
    Cheers,
    Adam
    XML generator:
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import javax.xml.stream.XMLOutputFactory;
    import javax.xml.stream.XMLStreamException;
    import javax.xml.stream.XMLStreamWriter;
    public class mainGenerator {
        public static void main(String[] args) throws FileNotFoundException, XMLStreamException {
            // TODO Auto-generated method stub
            final long numberOfSearches = 500;
            final long numberOfResults = 10000;
            XMLOutputFactory xof = XMLOutputFactory.newFactory();
            XMLStreamWriter writer = xof.createXMLStreamWriter(new FileOutputStream("C:\\Working\\generated500x10000.xml"));
            writer.writeStartDocument();
            writer.writeStartElement("tns","searches", "http://www.something.com/schema/simple_searches");
            writer.writeNamespace("tns", "http://www.something.com/schema/simple_searches");
            for (long i = 0; i < numberOfSearches; i++){
                Long help = new Long(i);
                writer.writeStartElement("tns","search", "http://www.something.com/schema/simple_searches);
                writer.writeAttribute("tns", "http://www.something.com/schema/simple_searches", "type", "value1");
                writer.writeAttribute("tns", "http://www.something.com/schema/simple_searches", "id", help.toString());
                writer.writeStartElement("tns","results", "http://www.something.com/schema/simple_searches");
                for (long j = 0; j < numberOfResults; j++){
                    writer.writeStartElement("tns","result", "http://www.something.com/schema/simple_searches");
                    Long helper = new Long(i*numberOfResults+j);
                    writer.writeAttribute("tns", "http://www.something.com/schema/simple_searches", "id", helper.toString());
                    writer.writeEndElement();
                writer.writeEndElement();
                writer.writeEndElement();
            writer.writeEndElement();
            writer.writeEndDocument();
            writer.close();
    registerSchema:
    begin
    dbms_xmlschema.registerSchema(
    'http://www.something.com/schema/simple_searches',
    '<?xml version="1.0" encoding="UTF-8"?>
    <schema targetNamespace="http://www.something.com/schema/simple_searches" elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.something.com/schema/simple_searches">
        <element name="searches" type="tns:searches_type"></element>
        <element name="search" type="tns:search_type"></element>
        <element name="results" type="tns:results_type"></element>
        <element name="result" type="tns:result_type"></element>
        <complexType name="searches_type">
            <sequence>
                <element ref="tns:search" maxOccurs="unbounded"></element>
            </sequence>
        </complexType>
        <complexType name="search_type">
            <sequence>
                <element ref="tns:results"></element>
            </sequence>
            <attribute ref="tns:id" use="required"></attribute>
            <attribute ref="tns:type" use="required"></attribute>
        </complexType>
        <complexType name="results_type">
            <sequence maxOccurs="unbounded">
                <element ref="tns:result"></element>
            </sequence>
        </complexType>
        <complexType name="result_type">
            <attribute ref="tns:id" use="required"></attribute>
        </complexType>
        <simpleType name="type_type">
            <restriction base="string">
                <enumeration value="value1"></enumeration>
                <enumeration value="value2"></enumeration>
            </restriction>
        </simpleType>
        <attribute name="type" type="tns:type_type"></attribute>
        <attribute name="id" type="string"></attribute>
    </schema>',
    TRUE, TRUE, FALSE, FALSE);
    end

  • OnClick for PL/SQL Code???

    Hello,
    I created a form and added a button. When that button is pressed, I want to execute PL/SQL code. In the list of JavaScript Event Handlers there is an event 'OnClick'. But I see nothing simular for the PL/SQL Button Event Handler.
    Where do I have to put my code?
    Thanks for your help.
    Nancy.

    I don't know how it is on this special app but what I do know is You have to submit Your form because PL?SQL procedures run only on server
    So You click on a button, link or whatever, PL/SQL procedure runs on the server and generates something to output again to client

  • Problems compiling PL/SQL code

    I am having problmes compiling the following piece of pl/sql
    code:
    declare
    v_servicekey services.servicekey%type;
    v_tmodelkey tmodels.tmodelkey%type;
    l_bindingid bindingtemplates.bindingid%type;
    i_rowlimit number(28);
    begin
    select bindingid
    into l_bindingid
    from
    (select b.bindingid as bindingid,
    b.bindingkey,
    nvl(b.accesspointurltype,''),
    nvl(b.accesspointurl,''),
    nvl(b.hostingredirector,''),
    b.updated
    from bindingtemplates b, services s
    where s.serviceid=b.serviceid
    and s.servicekey=v_servicekey
    and (b.bindingid in (select i.bindingid
    from instances
    i,tmodels t
    where
    t.tmodelid=i.tmodelid
    and
    t.tmodelkey=v_tmodelkey)
    or (b.hostingredirector is not
    null
    and b.hostingredirector in
    (select bindingkey
    from bindingtemplates
    where bindingid in (select i.bindingid
    from instances i,tmodels t
    where t.tmodelid = i.tmodelid
    and t.tmodelkey = v_tmodelkey))))
    order by b.updated)
    where rownum <= i_rowlimit;
    end;
    I get the compilation error
    ERROR at line 30:
    ORA-06550: line 30, column 27:
    PLS-00103: Encountered the symbol "ORDER" when expecting one of
    the following:
    ) * & = - + < / > in mod not rem with an exponent (**)
    <> or != or ~= >= <= <> and or like between group having
    intersect minus start union where connect is null is not ||
    is dangling year DAY_
    The symbol ")" was substituted for "ORDER" to continue.
    ORA-06550: line 30, column 45:
    PLS-00103: Encountered the symbol ")" when expecting one of the
    following:
    . ( , * @ % & - + ; / for mod rem an exponent (**) asc desc
    ||
    Obviously there is only one SQL and it is complaining about the
    ORDER BY clause. Please ignore the values for the host variables.
    The same SQL when run from the SQL prompt with values
    substituted for the host variables runs perfectly well. Am I
    missing something or is there a catch with Oracle PL/SQL.
    Please enlighten.
    Thanks

    "Order by" can not be used in the subqueries.
    Order by should always be specified in the outer query only.
    rajkiran

  • Code beautifier for PL/SQL

    Does anyone know of a good code beautifier for PL/SQL?

    A tool called "Formatter Plus" is available to do this job. You can download the tool from the Revealnet (recently acquired by Quest software) web site.
    The URL is http://www.quest-pipelines.com/
    I downloaded the 'free trail' version and it asked my
    to enter the license key, which they don't supply!
    WHAT A PIECE OF JUNK!

Maybe you are looking for