Apex in pl/sql

When i try to fetch dropdown values from table, It fetches more than 400 rows, even though i am using APEX_ITEM.SELECT_LIST_FROM_QUERY. Please see the code.
htp.p('<table>');
for i in (SELECT DISTINCT DESCRIPTION,CODE FROM EMPLOYEE
WHERE CODE = :'P39_PRODUCT_GROUP') LOOP
htp.p('<tr><td>');
htp.p(APEX_ITEM.DISPLAY_AND_SAVE(1,i.DESCRIPTION));
htp.p('</td><td>');
htp.p(APEX_ITEM.SELECT_LIST_FROM_QUERY_XL(2,'','SELECT ''-Select-'' EMPCODE,''-1'' EMPDESCRIPTION FROM DUAL
UNION ALL SELECT EMPCODE,EMPDESCRIPTION FROM EMPLOYEEDESCRIPTION
WHERE EMPCODE=''||i.CODE||''','','','','NO','','CODE',''));
htp.p('</td><td>');
htp.p(APEX_ITEM.DISPLAY_AND_SAVE(3,i.CODE));
htp.p('</td></tr>');
END LOOP;
htp.p('</table>');
It shows the dropdown with empty. Values are not in dropdown.

When I give two quotes before and after three quotes ''||i.CODE||'' .It display the page dropdown , but it not fetch the values. Only empty dropdown is display.
This is the code...
htp.p('<table>');
for i in (SELECT DISTINCT DESCRIPTION,CODE FROM EMPLOYEE
WHERE CODE = :'P39_PRODUCT_GROUP') LOOP
htp.p('<tr><td>');
htp.p(APEX_ITEM.DISPLAY_AND_SAVE(1,i.DESCRIPTION));
htp.p('</td><td>');
htp.p(APEX_ITEM.SELECT_LIST_FROM_QUERY_XL(2,'','SELECT ''-Select-'' EMPCODE,''-1'' EMPDESCRIPTION FROM DUAL
UNION ALL SELECT EMPCODE,EMPDESCRIPTION FROM EMPLOYEEDESCRIPTION
WHERE EMPCODE=''||i.CODE||''','','','','NO','','CODE',''));
htp.p('</td><td>');
htp.p(APEX_ITEM.DISPLAY_AND_SAVE(3,i.CODE));
htp.p('</td></tr>');
END LOOP;
htp.p('</table>');

Similar Messages

  • Creating APEX pages via SQL scripts..

    Hi Guys,
    I want to create APEX pages via SQL Script. The main reason to have this option that I have couple of applications which has XML files for screen definition where I can read all screen properties (field types, sizes, caption, etc...)
    Is there any documentation or help stuff where I can find the APEX page definition tables? I found something like WWV tables but I couldnt figure it out properly...
    Any help ?
    Thanks,
    Osman...

    We have built our entire apex app in a similar way. We create the shell apex pages using apex (eg, Item Detail, Insert Item, etc.). Then we create a PL/SQL region on the page. The PL/SQL region simply calls a stored procedure to render the controls on the page. For example, our regions looks similar to this:
    begin
    apex_pkg.sp_render_page('ITEM_DETAIL',Param1,Param2,Param3);
    end;
    The sp_render_page procedure in the database generates the appropriate HTML for the page. This procedure reads meta data in the database (eg, field label, field size, field type, field position, etc.) and renders the same HTML that apex would render if the apex page was manually created. For example, in the procedure we use lines similar to these:
    HTP.p(apex_item.text(...))
    HTP.p(apex_item.select_list_from_query(...))
    Because the procedure is reading meta data, the apex page is dynamic and can be different for different users or clients.
    Darrin

  • Using OID for authentication in APEX and PL/SQL apps

    Hi,
    One of my colleagues (much more skilled in APEX than me) has written a PL/SQL package that makes it easy to use Oracle Internet Directory (OID) groups to control access to pages and items in APEX. It assumes that you are already using Oracle Single Sign-On (which he also set up for us).
    Being a package, it's easy to use in any PL/SQL application.
    He's given me permission to add his work to my web page but prefers to remain anonymous. You can see how to do it here:
    http://www.patrickhaston.co.uk/plsql/oid_authorisation.html
    The source code is available for download.
    Hope this is useful.
    Patrick.

    Nothing new - all documented with APEX.

  • Enable SSL/https on ApEx Embedded PL/SQL Gateway/11g?

    Hi,
    I'm a newbie to ApEx. And I notice that most of ApEx applications are run on "http" instead of "https". Aren't you concerned about its security? What's your take on SSL/https with ApEx?
    I understand that it takes several steps to set it up on Oracle HTTP Apache server (ie: set up Oracle Wallet Manager, go to a certificate authority to get obtain a certificate, configure Oracle HTTP Server...etc). But does it work on Embedded PL/SQL Gateway (ie: runs XML DB HTTP instead of a separet Apache web server)?
    Any experience/suggestions/ideas?
    Thanks much,
    Helen

    Here is the Oracle documentation:
    [http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14259/xdb22pro.htm#CHDCAHDH]
    Here is a little more friendly post:
    [http://wiki.shellprompt.net/bin/view/Apex/SSLandAPEXxdbHttp?TWIKISID=6fa6f4a0bbb698921c333d6d0c859970]
    Friendly post originally from:
    Can the embedded PL/SQL gateway handle SSL?
    -Richard

  • APEX 4.1, SQL Query(Updateable report), Validation issue.

    Hi,
    I am using APEX 4.1.
    I have SQL Query(Updateable report), we have created validation for the columns in this report.
    The validations are working properly only for the first row of the report on submitting, the remaining rows are not getting validated.
    If we check mark the rows it will get validated, but we want the validation to happen without checkmarking, on all the rows on clicking submit button.
    Can someone help me to fix this issue?
    Thanks in advance.
    Thanks & regards,
    Ravi.

    Hi Ravi,
    Welcome to Oracle Forums!
    Please acquaint yourself with the FAQ and forum etiquette if you haven't already done so.
    Always state
    <ul>
    <li>Apex Version</li>
    <li>DB Version and edition</li>
    <li>Web server used.I.e. EPG, OHS, ApexListner Standalone or with J2EE container</li>
    <li>When asking about forms always state tabular form if it is a tabular form</li>
    <li>When asking about reports always state Classic / IR</li>
    <li>Always post code snippets enclosed in a pair of &#123;code&#125; tags as explained in FAQ</li>
    </ul>
    I am using APEX 4.1.I have SQL Query(Updateable report), we have created validation for the columns in this report.
    The validations are working properly only for the first row of the report on submitting, the remaining rows are not getting validated.
    If we check mark the rows it will get validated, but we want the validation to happen without checkmarking, on all the rows on clicking submit button.
    Can someone help me to fix this issue?
    >
    Post your validation code with some explanations of what the g_fnn are.
    Cheers,

  • Apex integration in SQL Developer

    Hi,
    I have the latest version of SQL Developer. But I still can't see the "Application Express" node in the object browser, although my schema is owner of an Apex application.
    When I connect on a machine with a local database (and apex), SQL Developer shows the extra apex-node!
    How comes ? What is the difference ?
    Regards,
    Jan

    There is a write-up about connecting to APEX here: <a href ="http://www.oracle.com/technology/products/database/application_express/html/sql_dev_integration.html" >SQL Dev Oracle APEX Integration</a>
    <p>You do need to have updated to Oracle APEX 3.0.1.
    <p>Regards <br>
    Sue

  • APEX 4.0 SQL ERROR -ORA-00942

    Hi, I'm new to APEX. I'm having some trouble getting the following which creates a view to execute. I keep getting the ora-00942 table or view does not exist when it reaches the code in bold. When i look at the objects in APEX and SQL Developer the table is right in front of me. Any insight as to why i'm getting this error?
    select ctt.firstname
    , ctt.lastname
    , ctt.contact_type
    , ads.address_type
    , ads.address_line1
    , ads.address_line2
    , ads.postcode
    , ads.city
    , ads.state
    , ads.country
    , aac.default_yn
    , ctt.id
    , ads.id
    from app_contacts ctt
    , app_addresses ads
    , app_ads_ctt aac
    where aac.ctt_id = ctt.id
    and aac.ads_id = ads.id
    The code is from a new book by Packt Publishing "APEX 4.0 Cookbook" which i'm using to get up to speed on APEX 4.0. I don't want to take any shortcuts. I'd really appreciate some help.
    Thanks

    Hi Ben,
    Here is the complete statement and i've indicated in bold where the error occurs. The problem area is enclosed in asterisks when encapsulated by
    create or replace view "APP_VW_CONTACTS" as
    select ctt.firstname
    , ctt.lastname
    , ctt.contact_type
    , ads.address_type
    , ads.address_line1
    , ads.address_line2
    , ads.postcode
    , ads.city
    , ads.state
    , ads.country
    , aac.default_yn
    , ctt.id
    , ads.id
    from app_contacts ctt
    , app_addresses ads
    , app_ads_ctt aac
    where aac.ctt_id = ctt.id
    and aac.ads_id = ads.id
    This code generates the ora-00942 error (table or view does not exist)  in SQL Developer and ora-00957 (duplicate column name) in APEX SQL WORKSHOP.
    Your code,SELECT * FROM user_tables WHERE LOWER(table_name) = 'app_ads_ctt';
    returns i row with a status of 'VALID' in SQL WORKSHOP.
    Edited by: 844466 on Mar 16, 2011 4:24 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Connecting apex with micrsoft sql server 2008

    Please help me in connecting database of sql server 2008 data via apex
    prashant

    Maybe this link could help:
    http://www.dbasupport.com/oracle/ora10g/connection01.shtml
    I extended it once for a MySQL connection:
    http://www.apex-at-work.com/2010/02/making-connection-from-oracle-xe-to.html
    Best regards,
    Tobias
    http://www.apex-at-work.com

  • Slow flash chart loading in Apex due to SQL performance!

    I am very new with Oracle. I have an application with lots of flash charts which are mostly very slow to load. My table size is over 10 million and growing. I think that most of my problems come from the SQL quries that I use, but do not understand most of the techniques I find in internet to tune it. Here is one example:
    select null,c.mydate label,c7.cnt "Rattle",c8.cnt "Climb",c9.cnt "Kick",c1.cnt "Footstep",c2.cnt "Vehicle",c4.cnt "Start"
    from (select unique TO_CHAR(RECORDDATE,'MM/DD/YY HH24:MI') as mydate,TO_CHAR(RECORDDATE,' yyyy-mm-dd HH24:MI') as sort from SCOTT.SCDATABASE4 WHERE RECORDDATE> TO_TIMESTAMP(:P2_DATE,'DD-MON-YYYYHH24:MI:SS') AND ID = :P2_ID AND RECORDDATE< TO_TIMESTAMP(:P2_DATE2,'DD-MON-YYYYHH24:MI:SS') AND (CLASS in (7,8,9,1,2,4))) c
    left join
    (select TO_CHAR(RECORDDATE,'MM/DD/YY HH24:MI') as mydate, count(1) cnt from SCOTT.SCDATABASE4 WHERE RECORDDATE> TO_TIMESTAMP(:P2_DATE,'DD-MON-YYYYHH24:MI:SS') AND ID = :P2_ID AND RECORDDATE< TO_TIMESTAMP(:P2_DATE2,'DD-MON-YYYYHH24:MI:SS') AND CLASS = 7 group by TO_CHAR(RECORDDATE,'MM/DD/YY HH24:MI')) c7 on (c.mydate = c7.mydate)
    left join
    (select TO_CHAR(RECORDDATE,'MM/DD/YY HH24:MI') as mydate, count(1) cnt from SCOTT.SCDATABASE4 where RECORDDATE> TO_TIMESTAMP(:P2_DATE,'DD-MON-YYYYHH24:MI:SS') AND ID = :P2_ID AND RECORDDATE< TO_TIMESTAMP(:P2_DATE2,'DD-MON-YYYYHH24:MI:SS') AND CLASS = 8 group by TO_CHAR(RECORDDATE,'MM/DD/YY HH24:MI')) c8 on (c.mydate= c8.mydate)
    left join
    (select TO_CHAR(RECORDDATE,'MM/DD/YY HH24:MI') as mydate, count(1) cnt from SCOTT.SCDATABASE4 where RECORDDATE> TO_TIMESTAMP(:P2_DATE,'DD-MON-YYYYHH24:MI:SS') AND ID = :P2_ID AND RECORDDATE< TO_TIMESTAMP(:P2_DATE2,'DD-MON-YYYYHH24:MI:SS') AND CLASS = 9 group by TO_CHAR(RECORDDATE,'MM/DD/YY HH24:MI')) c9 on (c.mydate = c9.mydate)
    left join
    (select TO_CHAR(RECORDDATE,'MM/DD/YY HH24:MI') as mydate, count(1) cnt from SCOTT.SCDATABASE4 WHERE RECORDDATE> TO_TIMESTAMP(:P2_DATE,'DD-MON-YYYYHH24:MI:SS') AND ID = :P2_ID  AND RECORDDATE< TO_TIMESTAMP(:P2_DATE2,'DD-MON-YYYYHH24:MI:SS') AND CLASS = 1 group by TO_CHAR(RECORDDATE,'MM/DD/YY HH24:MI')) c1 on (c.mydate = c1.mydate)
    left join
    (select TO_CHAR(RECORDDATE,'MM/DD/YY HH24:MI') as mydate, count(1) cnt from SCOTT.SCDATABASE4 WHERE RECORDDATE> TO_TIMESTAMP(:P2_DATE,'DD-MON-YYYYHH24:MI:SS') AND ID = :P2_ID AND RECORDDATE< TO_TIMESTAMP(:P2_DATE2,'DD-MON-YYYYHH24:MI:SS') AND CLASS = 2 group by TO_CHAR(RECORDDATE,'MM/DD/YY HH24:MI')) c2 on (c.mydate = c2.mydate)
    left join
    (select TO_CHAR(RECORDDATE,'MM/DD/YY HH24:MI') as mydate, count(1) cnt from SCOTT.SCDATABASE4 WHERE RECORDDATE> TO_TIMESTAMP(:P2_DATE,'DD-MON-YYYYHH24:MI:SS') AND ID = :P2_ID AND RECORDDATE< TO_TIMESTAMP(:P2_DATE2,'DD-MON-YYYYHH24:MI:SS') AND CLASS = 4 group by TO_CHAR(RECORDDATE,'MM/DD/YY HH24:MI')) c4 on (c.mydate = c4.mydate)
    order by c.sort I have oracle 11g working with Apex 4.1. I used the SQL workshop's explain plan:
    Operation     Options     Object     Rows     Time     Cost     Bytes     Filter
    Predicates *     Access
    Predicates
    SELECT STATEMENT
              66     703     58,573     9,966          
    SORT
    ORDER BY          66     703     58,573     9,966          
    HASH JOIN
    RIGHT OUTER          66     703     58,572     9,966          "C"."MYDATE" = "C1"."MYDATE"(+)
    VIEW
              1     101     8,358     22          
    HASH
    GROUP BY          1     101     8,358     18          
    FILTER
                                  TO_TIMESTAMP(:P2_DATE,'DD-MON-YYYYHH24:MI:SS')<TO_TIMESTAMP(:P2_DATE2,'DD-MON-YYYYHH24:MI:SS')     
    TABLE ACCESS
    FULL     SCDATABASE4     1     101     8,357     18     "CLASS" = 1 AND "ID" = TO_NUMBER(:P2_ID) AND "RECORDDATE">TO_TIMESTAMP(:P2_DATE,'DD-MON-YYYYHH24:MI:SS') AND "RECORDDATE"<TO_TIMESTAMP(:P2_DATE2,'DD-MON-YYYYHH24:MI:SS')     
    HASH JOIN
    OUTER          66     603     50,214     8,514          "C"."MYDATE" = "C2"."MYDATE"(+)
    HASH JOIN
    OUTER          66     503     41,853     7,062          "C"."MYDATE" = "C4"."MYDATE"(+)
    HASH JOIN
    OUTER          66     402     33,494     5,610          "C"."MYDATE" = "C9"."MYDATE"(+)
    HASH JOIN
    OUTER          66     302     25,135     4,158          "C"."MYDATE" = "C8"."MYDATE"(+)
    HASH JOIN
    OUTER          66     202     16,777     2,706          "C"."MYDATE" = "C7"."MYDATE"(+)
    VIEW
              66     102     8,418     1,254          
    HASH
    UNIQUE          66     102     8,418     1,188          
    FILTER
                                  TO_TIMESTAMP(:P2_DATE,'DD-MON-YYYYHH24:MI:SS')<TO_TIMESTAMP(:P2_DATE2,'DD-MON-YYYYHH24:MI:SS')     
    TABLE ACCESS
    FULL     SCDATABASE4     66     102     8,417     1,188     "ID" = TO_NUMBER(:P2_ID) AND ("CLASS" = 1 OR "CLASS" = 2 OR "CLASS" = 4 OR "CLASS" = 7 OR "CLASS" = 8 OR "CLASS" = 9) AND "RECORDDATE">TO_TIMESTAMP(:P2_DATE,'DD-MON-YYYYHH24:MI:SS') AND "RECORDDATE"<TO_TIMESTAMP(:P2_DATE2,'DD-MON-YYYYHH24:MI:SS')     
    VIEW
              1     101     8,358     22          
    HASH
    GROUP BY          1     101     8,358     18          
    FILTER
                                  TO_TIMESTAMP(:P2_DATE,'DD-MON-YYYYHH24:MI:SS')<TO_TIMESTAMP(:P2_DATE2,'DD-MON-YYYYHH24:MI:SS')     
    TABLE ACCESS
    FULL     SCDATABASE4     1     101     8,357     18     "CLASS" = 7 AND "ID" = TO_NUMBER(:P2_ID) AND "RECORDDATE">TO_TIMESTAMP(:P2_DATE,'DD-MON-YYYYHH24:MI:SS') AND "RECORDDATE"<TO_TIMESTAMP(:P2_DATE2,'DD-MON-YYYYHH24:MI:SS')     
    VIEW
              1     101     8,358     22          
    HASH
    GROUP BY          1     101     8,358     18          
    FILTER
                                  TO_TIMESTAMP(:P2_DATE,'DD-MON-YYYYHH24:MI:SS')<TO_TIMESTAMP(:P2_DATE2,'DD-MON-YYYYHH24:MI:SS')     
    TABLE ACCESS
    FULL     SCDATABASE4     1     101     8,357     18     "CLASS" = 8 AND "ID" = TO_NUMBER(:P2_ID) AND "RECORDDATE">TO_TIMESTAMP(:P2_DATE,'DD-MON-YYYYHH24:MI:SS') AND "RECORDDATE"<TO_TIMESTAMP(:P2_DATE2,'DD-MON-YYYYHH24:MI:SS')     
    VIEW
              1     101     8,358     22          
    HASH
    GROUP BY          1     101     8,358     18          
    FILTER
                                  TO_TIMESTAMP(:P2_DATE,'DD-MON-YYYYHH24:MI:SS')<TO_TIMESTAMP(:P2_DATE2,'DD-MON-YYYYHH24:MI:SS')     
    TABLE ACCESS
    FULL     SCDATABASE4     1     101     8,357     18     "CLASS" = 9 AND "ID" = TO_NUMBER(:P2_ID) AND "RECORDDATE">TO_TIMESTAMP(:P2_DATE,'DD-MON-YYYYHH24:MI:SS') AND "RECORDDATE"<TO_TIMESTAMP(:P2_DATE2,'DD-MON-YYYYHH24:MI:SS')     
    VIEW
              15     101     8,359     330          
    HASH
    GROUP BY          15     101     8,359     270          
    FILTER
                                  TO_TIMESTAMP(:P2_DATE,'DD-MON-YYYYHH24:MI:SS')<TO_TIMESTAMP(:P2_DATE2,'DD-MON-YYYYHH24:MI:SS')     
    TABLE ACCESS
    FULL     SCDATABASE4     15     101     8,358     270     "CLASS" = 4 AND "ID" = TO_NUMBER(:P2_ID) AND "RECORDDATE">TO_TIMESTAMP(:P2_DATE,'DD-MON-YYYYHH24:MI:SS') AND "RECORDDATE"<TO_TIMESTAMP(:P2_DATE2,'DD-MON-YYYYHH24:MI:SS')     
    VIEW
              49     101     8,361     1,078          
    HASH
    GROUP BY          49     101     8,361     882          
    FILTER
                                  TO_TIMESTAMP(:P2_DATE,'DD-MON-YYYYHH24:MI:SS')<TO_TIMESTAMP(:P2_DATE2,'DD-MON-YYYYHH24:MI:SS')     
    TABLE ACCESS
    FULL     SCDATABASE4     49     101     8,360     882     "CLASS" = 2 AND "ID" = TO_NUMBER(:P2_ID) AND "RECORDDATE">TO_TIMESTAMP(:P2_DATE,'DD-MON-YYYYHH24:MI:SS') AND "RECORDDATE"<TO_TIMESTAMP(:P2_DATE2,'DD-MON-YYYYHH24:MI:SS')
    From this I gather that the full database access is a bad thing, but do not know how to prevent it. I would appreciate any help and sorry for the long post!!

    End Of (rather busy) Week: Friday evening but your query
    select null,c.mydate label,c7.cnt "Rattle",c8.cnt "Climb",c9.cnt "Kick",c1.cnt "Footstep",c2.cnt "Vehicle",c4.cnt "Start"
      from (select unique
                   TO_CHAR(RECORDDATE,'MM/DD/YY HH24:MI') as mydate,
                   TO_CHAR(RECORDDATE,' yyyy-mm-dd HH24:MI') as sort
              from SCOTT.SCDATABASE4
             WHERE RECORDDATE > TO_TIMESTAMP(:P2_DATE,'DD-MON-YYYYHH24:MI:SS')
               AND ID = :P2_ID
               AND RECORDDATE < TO_TIMESTAMP(:P2_DATE2,'DD-MON-YYYYHH24:MI:SS')
               AND (CLASS in (7,8,9,1,2,4))
           ) c
           left join
           (select TO_CHAR(RECORDDATE,'MM/DD/YY HH24:MI') as mydate,
                   count(1) cnt
              from SCOTT.SCDATABASE4
             WHERE RECORDDATE > TO_TIMESTAMP(:P2_DATE,'DD-MON-YYYYHH24:MI:SS')
               AND ID = :P2_ID
               AND RECORDDATE < TO_TIMESTAMP(:P2_DATE2,'DD-MON-YYYYHH24:MI:SS')
               AND CLASS = 7
             group by TO_CHAR(RECORDDATE,'MM/DD/YY HH24:MI')
           ) c7
        on (c.mydate = c7.mydate)
           left join
           (select TO_CHAR(RECORDDATE,'MM/DD/YY HH24:MI') as mydate,
                   count(1) cnt
              from SCOTT.SCDATABASE4
             where RECORDDATE > TO_TIMESTAMP(:P2_DATE,'DD-MON-YYYYHH24:MI:SS')
               AND ID = :P2_ID
               AND RECORDDATE < TO_TIMESTAMP(:P2_DATE2,'DD-MON-YYYYHH24:MI:SS')
               AND CLASS = 8
             group by TO_CHAR(RECORDDATE,'MM/DD/YY HH24:MI')
           ) c8
        on (c.mydate= c8.mydate)
           left join
           (select TO_CHAR(RECORDDATE,'MM/DD/YY HH24:MI') as mydate,
                   count(1) cnt from SCOTT.SCDATABASE4
             where RECORDDATE > TO_TIMESTAMP(:P2_DATE,'DD-MON-YYYYHH24:MI:SS')
               AND ID = :P2_ID
               AND RECORDDATE < TO_TIMESTAMP(:P2_DATE2,'DD-MON-YYYYHH24:MI:SS')
               AND CLASS = 9
             group by TO_CHAR(RECORDDATE,'MM/DD/YY HH24:MI')
           ) c9
        on (c.mydate = c9.mydate)
           left join
           (select TO_CHAR(RECORDDATE,'MM/DD/YY HH24:MI') as mydate,
                   count(1) cnt
              from SCOTT.SCDATABASE4
             WHERE RECORDDATE > TO_TIMESTAMP(:P2_DATE,'DD-MON-YYYYHH24:MI:SS')
               AND ID = :P2_ID 
               AND RECORDDATE < TO_TIMESTAMP(:P2_DATE2,'DD-MON-YYYYHH24:MI:SS')
               AND CLASS = 1
             group by TO_CHAR(RECORDDATE,'MM/DD/YY HH24:MI')
           ) c1
        on (c.mydate = c1.mydate)
           left join
           (select TO_CHAR(RECORDDATE,'MM/DD/YY HH24:MI') as mydate,
                   count(1) cnt
              from SCOTT.SCDATABASE4
             WHERE RECORDDATE > TO_TIMESTAMP(:P2_DATE,'DD-MON-YYYYHH24:MI:SS')
               AND ID = :P2_ID
               AND RECORDDATE < TO_TIMESTAMP(:P2_DATE2,'DD-MON-YYYYHH24:MI:SS')
               AND CLASS = 2
             group by TO_CHAR(RECORDDATE,'MM/DD/YY HH24:MI')
           ) c2
        on (c.mydate = c2.mydate)
           left join
           (select TO_CHAR(RECORDDATE,'MM/DD/YY HH24:MI') as mydate,
                   count(1) cnt from SCOTT.SCDATABASE4
             WHERE RECORDDATE > TO_TIMESTAMP(:P2_DATE,'DD-MON-YYYYHH24:MI:SS')
               AND ID = :P2_ID
               AND RECORDDATE < TO_TIMESTAMP(:P2_DATE2,'DD-MON-YYYYHH24:MI:SS')
               AND CLASS = 4
             group by TO_CHAR(RECORDDATE,'MM/DD/YY HH24:MI')
           ) c4
        on (c.mydate = c4.mydate)
    order by c.sortseems just
    select null,
           c.mydate label,
           case when gc.CLASS = 7 then gc.cnt end "Rattle",
           case when gc.CLASS = 8 then gc.cnt end "Climb",
           case when gc.CLASS = 9 then gc.cnt end "Kick",
           case when gc.CLASS = 1 then gc.cnt end "Footstep",
           case when gc.CLASS = 2 then gc.cnt end "Vehicle",
           case when gc.CLASS = 4 then gc.cnt end "Start"
      from (select unique
                   TO_CHAR(RECORDDATE,'MM/DD/YY HH24:MI') as mydate,
                   TO_CHAR(RECORDDATE,' yyyy-mm-dd HH24:MI') as sort
              from SCOTT.SCDATABASE4
             WHERE RECORDDATE > TO_TIMESTAMP(:P2_DATE,'DD-MON-YYYYHH24:MI:SS')
               AND ID = :P2_ID
               AND RECORDDATE < TO_TIMESTAMP(:P2_DATE2,'DD-MON-YYYYHH24:MI:SS')
               AND (CLASS in (7,8,9,1,2,4))
           ) c
           left join
           (select TO_CHAR(RECORDDATE,'MM/DD/YY HH24:MI') as mydate,
                   CLASS,
                   count(1) cnt
              from SCOTT.SCDATABASE4
             WHERE RECORDDATE > TO_TIMESTAMP(:P2_DATE,'DD-MON-YYYYHH24:MI:SS')
               AND ID = :P2_ID
               AND RECORDDATE < TO_TIMESTAMP(:P2_DATE2,'DD-MON-YYYYHH24:MI:SS')
               AND CLASS in (7,8,9,1,2,4)
             group by TO_CHAR(RECORDDATE,'MM/DD/YY HH24:MI'),CLASS
           ) gc
        on c.mydate = gc.mydate
    order by c.sortRegards
    Etbin

  • Querying EBS data from APEX through PL/SQL process

    Hi all,
    I have read through http://www.oracle.com/technetwork/developer-tools/apex/apex-ebs-wp-cabot-consulting-169064.pdf
    and    http://www.oracle.com/technetwork/developer-tools/apex/learnmore/apex-ebs-extension-white-paper-345780.pdf
    But I still do not have much idea on how do I query for data from ebs. What I am trying to achieve is to query for a table in EBS and put the data as a httpresponse
    then parse the data using javascript by creating a html region in APEX.
    Previously, I was creating an application process in the following manner
    declare
    element_List varchar2(4000) := '';
    begin
    begin
    for i in (select END_MEASURE from SCS_ELEMENT_DATA where ATTRIBUTE10 = :P9_ASSET_ID) loop
    element_List := element_List || i.END_MEASURE || ' ';
    end loop;
    exception when no_data_found then null;
    end;
    htp.prn(element_List);
    end;
    My table structure in EBS is something like this:
    XXEAM_LAM_ELEMENTS (lam_element_id, csi_instance_id, element_name, element_desc, label, type, continuous, reference, shared, start_measure, end_measure, lat_long)
    Would appreciate any advice as I'm new to both APEX and EBS.

    Hi Scott and Tom,
    Sorry about this.
    My Apex is installed in the same instance as my EBS. I assume this means they are in the same DB? So if this is the case, can I just query with the EBS table name and the APEX application will know its EBS table and not APEX table?
    Because previously my query was based on APEX tables and now I have query based on my EBS table using an APEX application process. I couldn't really understand what's needed even after looking through the whitepaper. I do not need to create a view/report based on the queried data because my APEX page only has a HTML region where I put all my javascript code in.
    Hope this is clearer. Sorry for not being clear on my issue.
    Regards,
    CS

  • Constraint won't work in ApEX 3.0 SQL Worksheet

    I am trying to add a fk constraint with 'on cascade delete' but I am getting errors every time I try a different coding. This is my latest and I can not see what I have miscoded. Can anyone help?
    alter table DGNR_ADMINISTRATIVE_AREA
    add constraint adminREFnap_fk
    foreign key(ADMIN_NAP_FK)
    references DGNR_NAME_ACTION_PROPOSAL (NAP_ID)
    on cascade delete;
    Thanks,
    Maggie

    alter table DGNR_ADMINISTRATIVE_AREA
    add constraint adminREFnap_fk
    foreign key(ADMIN_NAP_FK)
    references DGNR_NAME_ACTION_PROPOSAL (NAP_ID)
    > on cascade delete;
    should be
    > on delete cascade ;

  • Apex: output message from pl/sql process

    Apex 4.2
    THis is kind of an Apex and Pl/Sql question, but more so Apex because I'm using that environment. I have a pl/sql process with an IF - Else statement. It's a real simple process where you check:
    IF P101_Count > 1 Then
       Do stuff;
    Else
       Output an error message.
    The process runs when I click a button.
    I am just not sure how to get an error message to display to the screen. I am not sure of the syntax.
    Any help on this topic would be greatly appreciated. Thanks in advance.

    Well, there a lots of ways to do this but, if you just want to see it on the screen, the easiest way is to add a Page Item (a Text Field for example). Then, in the Else portion just set it equal to the message that you are trying to display.
    If ( :P101_Count > 1 ) Then
    -- Do Stuff
    Else
    :P1_MY_MESSAGE := 'Hello World!';
    End If;
    -Joe

  • Sorry-duplicate thread,since problem in forumby5.45pm pl/sql region in apex

    Hi All,
    From sqlworkshop,
    I have created a view like
    CREATE OR REPLACE FORCE VIEW VW_SUB_CL_ADD1 AS
    (select a.siteid siteid,a.bpaadd_0 bpaadd_0,a.bpanum_0 bpanum_0,
    case when a.bpaaddlig_0 = '' then '-' else a.bpaaddlig_0 end address1,
    case when a.bpaaddlig_1 = '' then '-' else a.bpaaddlig_1 end address2,
    case when a.bpaaddlig_2 = '' then '-' else a.bpaaddlig_2 end address3,
    case when a.bpades_0 = '' then '-' else a.bpades_0 end place,
    case when a.cty_0 = '' then '-' else a.cty_0 end city,
    case when a.poscod_0 = '' then '-' else a.poscod_0 end pincode,
    case when b.cntnam_0 = '' then '-' else b.cntnam_0 end contactname,
    case when b.fax_0 = '' then '-' else b.fax_0 end fax,
    case when b.MOBTEL_0 = '' then '-' else b.MOBTEL_0 end mobile,
    case when b.TEL_0 = '' then '-' else b.TEL_0 end phone,
    case when b.web_0 = '' then '-' else b.web_0 end website,
    c.zinvcty_0 zcity,c.bpainv_0 bpainv_0,c.bpcnum_0 bpcnum_0
    from lbcreport.bpaddress@info a,lbcreport.contact@info b ,lbcreport.bpcustomer@info c
    where (a.bpanum_0=b.bpanum_0) and (a.cty_0 = c.zinvcty_0) and (a.siteid = c.siteid))
    but when i execute select * from vw_sub_cl_add1
    the case is not working. '-' is not getting displayed for null values even i tried nvl function it is not working
    when i use this view in apex for pl/sql region to display in the form of table .
    The problem is, when there is no value in the columns the table is not showing row and column in a proper manner.
    could any one help to overcome it.
    Thanks in advance
    bye
    Srikavi
    Edited by: srikavi on Sep 10, 2008 10:42 AM

    Srikavi,
    1. The problem with null values is a template problem. Using Firefox and Web Developer Toolbar extension / CSS / View Style Information, you can find out which css class your report is referencing. Open the corresponding css file and add the following to the css class:
    empty-cells:show;border-collapse:collapse;
    It will show the borders for null values after that.
    2. b.fax_0 = '' is not correct. It should be b.fax_0 IS NULL.
    3. You can also try to use the built in property for showing NULL values as in the report attributes.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • Pl/sql region in apex

    Hi All,
    From sqlworkshop,
    I have created a view like
    CREATE OR REPLACE FORCE VIEW VW_SUB_CL_ADD1 AS
    (select a.siteid siteid,a.bpaadd_0 bpaadd_0,a.bpanum_0 bpanum_0,
    case when a.bpaaddlig_0 = '' then '-' else a.bpaaddlig_0 end address1,
    case when a.bpaaddlig_1 = '' then '-' else a.bpaaddlig_1 end address2,
    case when a.bpaaddlig_2 = '' then '-' else a.bpaaddlig_2 end address3,
    case when a.bpades_0 = '' then '-' else a.bpades_0 end place,
    case when a.cty_0 = '' then '-' else a.cty_0 end city,
    case when a.poscod_0 = '' then '-' else a.poscod_0 end pincode,
    case when b.cntnam_0 = '' then '-' else b.cntnam_0 end contactname,
    case when b.fax_0 = '' then '-' else b.fax_0 end fax,
    case when b.MOBTEL_0 = '' then '-' else b.MOBTEL_0 end mobile,
    case when b.TEL_0 = '' then '-' else b.TEL_0 end phone,
    case when b.web_0 = '' then '-' else b.web_0 end website,
    c.zinvcty_0 zcity,c.bpainv_0 bpainv_0,c.bpcnum_0 bpcnum_0
    from lbcreport.bpaddress@info a,lbcreport.contact@info b ,lbcreport.bpcustomer@info c
    where (a.bpanum_0=b.bpanum_0) and (a.cty_0 = c.zinvcty_0) and (a.siteid = c.siteid))
    but when i execute select * from vw_sub_cl_add1
    the case is not working. '-' is not getting displayed for null values even i tried nvl function it is not working
    when i use this view in apex for pl/sql region to display in the form of table .
    The problem is, when there is no value in the columns the table is not showing row and column in a proper manner.
    could any one help to overcome it.
    Thanks in advance
    bye
    Srikavi

    Hi Srikavi,
    From your statement, it looks as though you are retrieving data from an external datasource? I have had a similar problem - it's due to the ODBC driver not recognizing nulls properly. In the end, I had to do something like:
    case when xxx is null then '-' when xxx = ' ' then '-' when xxx = '' then '-' else xxx end xxxxx,
    ...This particularly happens with MS SQL databases and especially when their tables use char instead of varchar fields. The MSSQL table treats "empty" char fields as nulls but the ODBC driver doesn't - so the IS NULL value won't work on Oracle's side and the '' comparison won't always work on MS SQL side; hence having to check for all possibilities. The above may be overkill, but it did the job!
    Andy

  • UTL_HTTP, different error codes: APEX SQL Commands vs. Oracle SQL Developer

    Hi, omniscient all!
    I have a code sample where I try to request some URL from an inactive server:
    declare
      l_text varchar2(32000);
    begin
      l_text := utl_http.request('http://inactive.url:7777');
    exception
      when others then
        declare
          l_errcode number := utl_http.get_detailed_sqlcode;
        begin
          dbms_output.put_line(l_errcode);
          dbms_output.put_line(sqlerrm(l_errcode));
        end;
    end;
    /When I run it in Oracle SQL Developer it shows:
    anonymous block completed
    -12541
    ORA-12541: TNS:no listenerWhen I run it in the APEX 4.0 SQL Commands window it shows:
    -29263
    ORA-29263: HTTP protocol error
    Statement processed.The question is: why?
    In real world, I need to make a HTTP POST request (no problem) and catch some exceptions. But instead of the usual ORA-12541 error APEX throws an ORA-29261 one.

    Any thoughts?

Maybe you are looking for

  • How can I Add a photo to a catalog from inside another catalog

    I have a number of large catalogs with a small subset of pictures that have been edited and printed. I'd like to be able to have just a catalog of printed images so i can easily find them, reprint them, edit them etc. but not move them from their ori

  • The action cannot be completed. the connection to microsoft exchange is unavailable

    Hi dear. We have exchange 2013 and we want auto configure outlook 2007,2010 and 2013. In first time when we are setup exchange 2013 we can auto  configure outlook. But I don't know now we cannot configure outlook. I think when we make some change in

  • Yosemite install a complete fail, how can I get my computer to work again?

    i Tried to install Yosemite  and the computer (Mac mini) failed on the install.  Tried to restart and then unplugged.  Turns out some of the OS installed and can no longer get my computer to reach the home screen.  After starting the status bar gets

  • Drill down problem when using union all combination

    Hi All, I have a simple report with a drill down. The report has three columns Region, Sales, Flag... which will drill down to detail level of sales. The Flag column has Y, N values and we added 'All' Value in flag so that the user can select Y, N an

  • Cannot trash shared HD

    File sharing with leopard on the mac in question with another mac that is using tiger (if that matters). It seems that I cannot trash the HD or home folder that is being shared on the leopard mac without stopping file sharing. In tiger I could trash