Dynamic sql in dynamic page

I have problem of retrieving data from dynamic sql query.
I have
select 'select * from some_table' from dual
and I have to execute in dynamic page or report inner statement.
htp.p not help
I will appreciate any help from anybody.

Hi,
You cannot have a dynamic table selection but if you want to use a select statement then you can use oracle tags in the html code like this
<html>
<title>
new page
</title>
<body>
<oracle>
select * from scott.emp
</oracle>
</body>
</html>
Thanks,
Sharmila

Similar Messages

  • Dynamic sql with dynamic bulk collection variable

    Hi,
    I am facing the issue while bulk collecting dynamic sql query data into dynamic variable.
    Eg:
    query1:= << dynamic select query>>
    Execute immediate query1 bulk collect into Dynamic_varibale;
    here dynamic_varible is pl/sql table type with 1 column.
    How do i declare "dynamic_variable" here????
    please suggest...

    create type t_id is table of number
    SQL> create type t_id is table of number
      2  /
    Type created.
    SQL> declare
      2
      3   v_tid t_id;
      4   v_results sys_refcursor;
      5
      6   v_employee_id number;
      7   v_name varchar2(100);
      8
      9   v_sql varchar2(1000);
    10
    11
    12  begin
    13   v_tid := t_id(7902,7934);
    14
    15  --
    16
    17
    18   v_sql := 'select empno, ename from scott.emp ' ||CHR(10)
    19           || 'where empno in (select column_value from table(cast(:v_tid as
    t_id)))';
    20
    21   dbms_output.put_line(v_sql);
    22   dbms_output.put_line('----------');
    23
    24   open v_results for v_sql using v_tid;
    25
    26
    27   IF v_results IS NOT NULL
    28     THEN
    29        LOOP
    30           FETCH v_results
    31            INTO v_employee_id, v_name;
    32
    33           EXIT WHEN (v_results%NOTFOUND);
    34           dbms_output.put_line(v_name);
    35        END LOOP;
    36
    37        IF v_results%ISOPEN
    38        THEN
    39           CLOSE v_results;
    40        END IF;
    41    END IF;
    42
    43  end;
    44  /
    select empno, ename from scott.emp
    where empno in (select column_value from
    table(cast(:v_tid as t_id)))
    FORD
    MILLER

  • Dynamic SQL substituting dynamic table name with slct statement having date

    Hello,
    I just wanted some help with the following PL block. My problem is whenever I try to run this block it ask for invoking values for 2 substitute variables, though no substitute variables present in the code. Please find the code below:
    Declare
    cursor C_1 is
    select unique table_name from gsi_daily_count;
    table_names varchar2(240);
    Begin
    Open C_1;
    Loop
    Fetch C_1 into table_names;
    EXIT WHEN C_1%NOTFOUND;
    EXECUTE IMMEDIATE' select last_extract_date,
    to_char(min(greatest(nvl(last_update_date,'||01-Jan-10||'),nvl(program_update_date,'||01-Jan-10||'))),'||DD-MON-YY HH24:MI:SS||') mi,
    to_char(max(greatest(nvl(last_update_date,'||01-Jan-10||'),nvl(program_update_date,'||01-Jan-10||'))),'||DD-MON-YY HH24:MI:SS||') ma
    from' || table_names ||'
    group by last_extract_date
    order by last_extract_date desc';
    End Loop;
    Close C_1;
    COMMIT;
    End;
    Please help.
    Thanks in advance.

    You cannot specify your dates the way you have since they are being intepreted as bind variables:
    Try this:
    Declare
      cursor C_1 is
        select unique table_name
        from gsi_daily_count;
        table_names varchar2(240);
    Begin
      Open C_1;
      Loop
        Fetch C_1 into table_names;
        EXIT WHEN C_1%NOTFOUND;
        EXECUTE IMMEDIATE' select last_extract_date,
                                  to_char(
                                          min(
                                                greatest(
                                                          nvl(last_update_date,to_date('''|| '01-Jan-10' ||''',''dd-Mon-yy''))
                                                         ,nvl(program_update_date,to_date('''|| '01-Jan-10' ||''',''dd-Mon-yy''))
                                             ),''DD-MON-YY HH24:MI:SS''
                                         ) mi
                                  to_char(
                                          max(
                                                greatest(
                                                          nvl(last_update_date,to_date('''|| '01-Jan-10' ||''',''dd-Mon-yy''))
                                                         ,nvl(program_update_date,to_date('''|| '01-Jan-10' ||''',''dd-Mon-yy''))
                                             ),''DD-MON-YY HH24:MI:SS''
                                         ) ma
                          from ' || table_names ||'
                          group by last_extract_date
                          order by last_extract_date desc';
      End Loop;
      Close C_1;
      COMMIT;
    End;
    / There is not way for me to test this, so you may have to play around with all the quotes!

  • Performance between SQL Statement and Dynamic SQL

    Select emp_id
    into id_val
    from emp
    where emp_id = 100
    EXECUTE IMMEDIATE
    'Select '|| t_emp_id ||
    'from emp '
    'where emp_id = 100'
    into id_valWill there be more impact in performance while using Dynamic SQL?

    CP wrote:
    Will there be more impact in performance while using Dynamic SQL?All SQLs are parsed and executed as SQL cursors.
    The 2 SQLs (dynamic and static) results in the exact same SQL cursor. So both methods will use an identical cursor. There are therefore no performance differences ito of how fast that SQL cursor will be.
    If an identical SQL cursor is not found (a soft parse), the SQL engine needs to compile the SQL source code supplied, into a SQL cursor (a hard parse).
    Hard parsing burns a lot of CPU cycles. Soft parsing burns less CPU cycles and is therefore better. However, no parsing at all is the best.
    To explain: if the code creates a cursor (e.g. INSERT INTO tab VALUES( :1, :2, :3 ) for inserting data), it can do it as follows:
    while More Data Found loop
      parse INSERT cursor
      bind variables to INSERT cursor
      execute INSERT cursor
      close INSERT cursor
    end loopIf that INSERT cursor does not yet exists, it will be hard parsed and a cursor created. Each subsequent loop iteration will result in a soft parse.
    However, the code will be far more optimal as follows:
    parse INSERT cursor
    while More Data Found loop
      bind variables to INSERT cursor
      execute INSERT cursor
    end loop
    close INSERT cursorWith this approach the cursor is parsed (hard or soft), once only. The cursor handle is then used again and again. And when the application is done inserting data, the cursor handle is released.
    With dynamic SQL in PL/SQL, you cannot really follow the optimal approach - unless you use DBMS_SQL (a complex cursor interface). With static SQL, the PL/SQL's optimiser can kick in and it can optimise its access to the cursors your code create and minimise parsing all together.
    This is however not the only consideration when using dynamic SQL. Dynamic SQL makes coding a lot more complex. The SQL code can now only be checked at execution time and not at development time. There is the issue of creating shareable SQL cursors using bind variables. There is the risk of SQL injection. Etc.
    So dynamic SQL is seldom a good idea. And IMO, the vast majority of people that post problems here relating to dynamic SQL, are using dynamic SQL unnecessary. For no justified and logical reasons. Creating unstable code, insecure code and non-performing code.

  • JDBC, Using Dynamic SQL

    How to implement dynamic SQL (like dynamic SQL Method 4 in Pro*C), which
    lets program accept or build dynamic SQL statements that contain an unknown
    number of select-list items or placeholders?

    You don't need the Oracle specific stuff. You can use ResultSetMetadata to analyze what your SQL statement returned. (I assume that's what you mean with "number of select-list items"). Basically:Statement stmt = connection.createStatement();
    boolean hasResult = stmt.execute(sql);
    if (hasResult)
      ResultSet rs = stmt.getResultSet();
      ResultSetMetadata meta = rs.     getMetaData();
      for (int c=0; c < meta.getColumnCount(); c++)
         System.out.println("Column: " + meta.getColumnName(c + 1); // column number starts at 1!
    }You will not be able to check whether your statement contains parameters/placeholders (to be used with PreparedStatements) because the Oracle driver does not implement the necessary methods.

  • Can we use Dynamic SQL in Oracle Reports ?

    Hi ,
    Can we use Dynamic SQL in Oracle Reports ?
    If yes please give some examples .
    Thanx
    srini

    I believe the built-in package SRW.Do_Sql is what you are looking for
    Example from the document:
    /* Suppose you want to create a "table of contents" by getting the
    ** first character of a columns value, and page number on which its
    ** field fires to print. Assume that you want to put the "table of
    contents"
    ** into a table named SHIP. You could write the following construct:
    DECLARE
    PAGE_NO NUMBER;
    PAGE_FOR INDEX NUMBER;
    SORT_CHAR CHAR(1);
    CMD_LINE CHAR(200);
    BEGIN
    SORT_CHAR := :SORT_NAME ;
    IF :CALLED = Y THEN
         SRW.GET_PAGE_NUM(PAGE_FOR_INDEX);
         SRW.USER_EXIT(RWECOP PAGE_FOR_INDEX
         P_START_PAGENO);
         SRW.MESSAGE(2,TO_CHAR(:P_START_PAGENO));
    END IF;
    SRW.GET_PAGE_NUM(PAGE_NO);
    CMD_LINE := INSERT INTO SHIP VALUES
                          (||SORT_CHAR||,||TO_CHAR(PAGE_NO)||);
    SRW.MESSAGE(2,CMD_LINE);
    SRW.DO_SQL(CMD_LINE);
    COMMIT;
    EXCEPTION
      WHEN DUP_VAL_ON_INDEX THEN
            NULL;
      WHEN SRW.DO_SQL_FAILURE THEN
            SRW.MESSAGE(1,FAILED TO INSERT ROW INTO SHIP TABLE);
      WHEN OTHERS THEN
           COMMIT;
    END;

  • Dynamic SQL and PL/SQL Gateway

    This question is kind of out of curiosity...I had created a procedure that used some dynamic sql (execute immediate), and was trying to use it on pl/sql gateway. I kept getting page not found errors until I removed the execute immediate statement, and reverted to using static sql statements.
    I am just curious, is dynamic sql not supported at all with pl/sql gateway?
    Thanks
    Kevin

    > Relax damorgan, no need to be condescending. Of course I read the docs ..
    Well, you're one of the few that actually read the docs.. And one of many that lacked to state any real technical details for forum members to understand the actual problem, the actual error, and what the environment is that this is happening in.
    Remember that you came to this forum for forum members to help you. In order for us to do that, you need to help us understand
    - your problem
    - your environment
    - what you have tried
    What PL/SQL Gateway do you refer to? Thus is an old term for an old product - today in Oracle there are two "gateways" into the PL/SQL engine via HTTP. Via Apache/mod_plsql and via the internal Java servlet web engine called EPG inside Oracle.
    As for what the "Gateway" access to the PL/SQL engine via HTTP.. whether it supports EXECUTE IMMEDIATE or not is like asking if a car "supports" soft drinks or not (just because a human that may consume soft drinks acts as the driver of the car). Not sensible or relevant at all.
    mod_plsql creates an Oracle session to the database instance, and executes a PL/SQL procedure in the database. This is no different from any other client connection to Oracle. Oracle has no clue that the client is mod_plsql and not TOAD or Java or VB or PHP or Perl or whatever else.
    So how can this support or not support the EXECUTE IMMEDIATE command? Does PL/SQL support EXECUTE IMMEDIATE? Well duh...
    Why do you get a generic 404? Because the PL/SQL call made by mod_plsql failed with an unhandled exception. mod_plsql gets that exception and now what? Was a valid HTP buffer created for it to stream to the web browser? If the buffer perhaps partially completed? All that mod_plsql knows is that it asked for a HTP buffer via that PL/SQL call and it got an exception in return.
    A 404 HTTP error is the only reasonable and logical response for it to pass to the web browser in this case.
    PS. to see why mod_plsql fail, refer to the access_log and error_log of that Apache httpd server

  • Strange behavior when searching a phrase using reg exp and dynamic sql

    Hi,
    I have a strange issue while using dynamic sql for an apex page. I have a requirement to search a string in the database column which is entered by user on a page item. The search process should search the whole phrase only.
    I have a query generated dynamically in the back end and use it in a cursor in the stored procedure
      SELECT t.group_cn , t.group_desc, t.group_type, t.partner_organization_id, t.partner_organization
      FROM vr_idm_group t WHERE regexp_like(t.group_desc,'(^|\W)HR Selection & Assignment(\W|$)', 'i')The pl sql code with the dynamic sql statements are below.
       IF p_search_process NOT in ('PARTNER') THEN
          OPEN v_cursor FOR v_sql;
       ELSE
          OPEN v_cursor FOR v_sql USING p_search_id;
       END IF;
       LOOP
          FETCH v_cursor INTo v_obj.group_cn, v_obj.group_desc, v_obj.group_type, v_obj.partner_organization_id,
             v_obj.partner_organization, v_obj.match_count;
          EXIT WHEN v_cursor%NOTFOUND ;
          v_search_array.extend;
          v_search_array(v_search_array.last) := v_obj;
          dbms_output.put_line(v_sql);
       END LOOP;The search works fine if the search string does not contain any special character like &,- etc.
    However, if the search string contains any special character, it does not return any thing. This strange issue happens only if I call the procedure from the apex page and the search string contains a special character. (please note that the procedure works fine even from apex if the string does not have a special character). When I debugged this, found that, the cursor does not fetch any rows (it is supposed to fetch two rows) for unknown reason. When I run the query separately, it returns the two rows (in which the column group_desc contains the search string "HR Selection & Assignment") as desired. Also, when I test the procedure in the back end (PLSQL developer), it works fine.
    Any idea, what is causing this strange behaviour?
    Advance thanks.
    Regards,
    Natarajan

    i don't see anything about a dataProvider.  you're assigning a source for a scrollpane.  scrollpane's don't have a dataProvider property.
    anyway, other than arrayRun always being false when that last if-statement executes, what's the problem?  doesn't that movieclip display when that 2nd branch of the last if-statement executes (assuming instance is defined correctly etc)?

  • XSQL Servlet and Dynamic SQL

    Does the XSQL servlet support dynamic SQL? Take a stock screening page as an example. In this example you want to dynamically build the where clause based on user input. Thus if a Minimum PE Ratio of 3 was entered, the where clause of "where PE_Ratio >= 3" would be appended to the query. In this case there may be up to 20 different parameters or more to be mapped dynamically, so it wouldn't be feasible to nest all of the different combinations.

    XSQL Supports lexical substitution parameters
    so any and every part of any query can be parameterized.
    The extreme case is:
    <query> {@sql} </query>
    where the entire query is passed in
    in a parameter (named "sql").
    But any combination of parameters
    and substitutions is legal and can
    be used to do what you want.
    Since the variables are not BIND
    variabled, but instead lexical
    substitution variables, you can
    do things like:
    <query>
    select {@collist}
    from {@table}
    where {@where}
    order by {@orderby}
    </query>
    You can provide default parameter values
    using XML attributes on the <query>
    element which then can be overridden
    if a value is passed in in the request...
    <query collist="ename, sal"
    orderby="sal desc"
    where="1=1"
    from="dept">
    select {@collist}
    from {@table}
    where {@where}
    order by {@orderby}
    </query>
    And then a request to the page
    can pass in a orderby=decode(comm,null,1,0)
    or something to override the defaults.
    null

  • Erratic Report Region Behavior with Dynamic SQL Queries

    I'm running HTMLDB v 1.5.1.00.12 and I've noticed some odd behavior with report regions using dynamic SQL queries. Every so often, our testers will run a page containing a dynamic sql report region and get the following error, (despite the fact the query was working only moments ago and no other developer has touched it):
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    or sometimes
    failed to parse SQL query:ORA-01403: no data found
    The only solution I've found so far is to:
    1) Make a copy of the failed report region.
    2) Disable or delete the original failed report region.
    The new copy of the report region runs without issue.
    My search of the forums turned up the following two threads, but neither provided me with a clear explanation of the cause, and how to avoid it:
    ORA-06502:PL/SQL: numeric or value error: character string buffer too small
    Re: Import Export Error (ORA-06502)
    The columns being returned are below the 4000 character limit, and the rows being returned are far less than 32k in size.
    Could this have anything to do with the way HTMLDB is internally storing the PL/SQL used to generate the dynamic SQL Query? Is there any known issue related to this with that version of HTMLDB?
    This problem occurs without any discernable pattern or consistency, making it hard to determine where I should focus my efforts in tracking down the cause.

    Hi all,
    My report seems to be behaving correctly once i set it to "Use Generic Column Names (parse query at runtime only)" :)
    Cheers,
    Joel

  • Dynamic sql in a trigger ...please help

    HI All,
    I've got a really large table called 'shop' of the form
    id number, product1_cost number, product2_cost number,product3_cost, product4_cost....and so on until product20_cost,
    product1_desc, product2_desc....and so so on until..product20_desc, active, start_date, end_date, usercreated,
    useramended.
    I have now created a new application. The new table is called 'products' which has an id, cost, description, oldproductid, shopid
    I need a trigger on the table shop so that if anyone uses the old application, it automatically creates the product rows in my new table 'products'
    Not all the product fields on the 'shop' table have data so I only want to migrate data if necessary.
    The trigger would do the following:
    1. Loop through all the products, if the product was updated and product number does not exist on 'products.oldproductid' then create a new record in products
    2. If product was updated and product number does exist then simply update the product details.
    I have got the trigger to work with product1. However, I'm finding it difficult to write some sort of dynamic sql that would
    do the same check on all 20 products without having to repeat the code 20 times.
    can someone help?
    CREATE OR REPLACE TRIGGER TR_PRODCOST
    AFTER UPDATE ON SHOP
    FOR EACH ROW
    DECLARE
    v_oldproductid products.oldpackageid%TYPE;
    v_datedl products.datedl%TYPE;
    v_product_sq number;
    v_status number := 1;
    v_cost number(11, 2);
    v_old_pkg number:= :old.product1_cost;
    v_new_pkg number:= :new.product1_cost;
    v_old_desc varchar2(100):= :old.product1_desc;
    v_new_desc varchar2(100):= :new.product1_desc;
    v_old_shop varchar2(10):= :old.shopid;
    v_new_shop varchar2(10):= :new.shopid;
    CURSOR get_newproduct_cur IS
    SELECT p.oldproductid, p.datedl
    FROM products p
    WHERE p.shopid = v_new_shop
    AND p.oldproductid = 1;
    BEGIN
    IF nvl(v_new_pkg, -1) <> nvl(v_old_pkg, -1) THEN
    OPEN get_newproduct_cur;
    FETCH get_newproduct_cur
    INTO v_oldproductid, v_datedl;
    IF get_newproduct_cur%NOTFOUND THEN
    v_oldproductid := null;
    v_datedl := null;
    END IF;
    CLOSE get_newproduct_cur;
    IF v_oldproductid is null THEN
    SELECT SEQ_products.nextval INTO v_product_sq FROM dual;
    INSERT into products p
    (product_ID,
    SHOPID,
    DESCRIPTION,
    COST,
    DATECR,
    USERCR,
    OLDproductID,
    SHORT_DESCRIPTION)
    VALUES
    (v_product_sq,
    v_new_shop,
    v_new_desc,
    v_new_pkg,
    sysdate,
    'OLFORMS',
    1,
    v_new_desc);
    ELSE
    IF v_new_pkg is null THEN
    UPDATE products p
    set p.datedl = sysdate,
    p.cost = 0.00
    WHERE p.shopid = v_new_shop
    AND p.oldproductid = 1;
    ELSE
    UPDATE products p
    set p.cost = v_new_pkg,
    p.datedl = null,
    WHERE p.shopid = v_new_shop
    AND p.oldproductid = 1;
    END IF;
    IF v_new_desc = v_old_desc THEN
    v_status := 1;
    ELSE
    UPDATE products p
    SET p.description = v_new_desc
    WHERE p.shopid = v_new_shop
    AND p.oldproductid = 1;
    END IF;
    END IF;
    ELSE
    END IF;
    END IF;
    END;

    Hi All,
    Thanks about your advice on the relational design. However, this is only a temporary fix. The old shop table was created about 10 years ago by someone else. Our users have to use the old pages for about 2-3 weeks and therefore I need a quick fix that will create the products on the new tables.
    The other problem I have is that another powerbuilder based applicated also uses the same tables and that application is being modified to use the new tables but not until another 3 weeks. To ensure both systems are available in parallel, I have to implement this temporary solution.
    B_Binoy, you seem you have a solution there but I didn't quite get it. I tried putting the whole pl/sql block in a string, replacing the '1' in product 1 using a variable x and then using execute immediate but because of the :new and :old bind variables, it kept giving me errors like 'variables not bound' etc. If you don't mind, please can you expand on your solution?
    Many Thanks

  • Flash chart with dynamic sql query does not display

    Hi,
    In my schema SIVOA I have a lot of tables declared like this :
      CREATE TABLE "SIVOA"."EVV_xxxx"
       (     "CLEF_VAR" NUMBER(4,0),
         "DATE1" DATE,
         "VALEUR" NUMBER(16,8) Only the last part of the name changes "xxxx". For example E009, E019, etc....
    I am making a chart page with report and want the user to select a name of a table and I will display using dynamic sql query, the table report and chart.
    P184_ENAME is a select list returning the last part of the name of the table, fro example 'E009', 'E019', etc.
    P8_CLEF_VAR is an item containing a value. This value is a key retrieved like this :SELECT CLEF_VAR
    FROM SIVOA.SITE_ECHELLE
    WHERE SITE = :P184_ENAMEI built a classic report using a sql dynamic function :DECLARE
    x VARCHAR2 (4000);
    BEGIN
    x := 'SELECT NULL, DATE1, VALEUR FROM SIVOA.EVV_'
    || UPPER(:p184_ename)
    || ' WHERE CLEF_VAR = :p8_clef_var' ;
    RETURN (x);
    END;:p8_clef_var is an itme containing the value '4544'.
    This works perfectly fine !
    When I use this sql fucytion into a flash chart it does not work. I get this message "No data found".
    I do not understand why a the report get a result and not the chart !
    But if i hard-code the number of the CLEF_VAR instead of fetching it from :p8_clef_var I get a nice chart ! Go figure !DECLARE
    x VARCHAR2 (4000);
    BEGIN
    x := 'SELECT NULL, DATE1, VALEUR FROM SIVOA.EVV_'
    || UPPER(:p184_ename)
    || ' WHERE CLEF_VAR = 4544 ' ;
    RETURN (x);
    I cannot stay with the key (CLEF_VAR) hard-coded unformtunately !
    My question is how to get the chart displaying properly ??
    Thank you for your kind answers.
    Christian                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Alex,
    Using your request, with the classic report I get results (data), but I get the same message with the Flash chart : "No data found" ! I don't know how to investigate this. i tried many things but nothing works.
    Christian
    PS I tried this :
    DECLARE
       X   VARCHAR2 (4000);
    BEGIN
    x := 'SELECT NULL, DATE1, ROUND(VALEUR,2) FROM SIVOA.EVV_'
          || UPPER (:p184_ename) ||
          ' WHERE CLEF_VAR = '
          || :p8_clef_var ||
          ' AND DATE1 BETWEEN TO_DATE ('''
    ||:P8_DATE_DEBUT||''', ''DD/MM/YYYY HH24:MI'') AND TO_DATE ('''
    ||:P8_DATE_FIN||''', ''DD/MM/YYYY HH24:MI'')'
    RETURN (X);
    END; But it does not work either. I could find that the SLQ syntax generated is good becaus I put it into an item which display the return done by the pls/sql.
    What is sttange also with the classic report is that if I do click on next or previous to see another rows, I get the message "No data found". If I try to export the report I get an excel file with "No data fouid".
    Does anybody already tried my "need" here ? i find strange thant I should not be the firs one trying to get a report an tables which name would be "dynamic".
    Tahnk you.
    Edited by: Christian from France on Feb 13, 2009 3:05 AM

  • How to obtain IR report dynamic SQL in Apex 4.0

    Hello,
    I have 2 regions on the same page
    Interactive Report –
    Chart (Flash Chart) – This is a sub region of the above
    Now the requirement is when user applies a filter to the interactive report I would like to apply the same filter criteria to the flash chart so that data representation in flash chart matches with the IR report content. I am fairly new to the Apex, apologies if  used any apex terminology in correctly
    Appreciate if you  can point me in the right direction
    Thank you
    -Raj

    Hello , I did some research how to achieve this , one way is to get the IR report dynamic sql using APEX_IR.GET_REPORT package and apply the same sql for the chart  so that the chart representation will match with the IR report data, But the challenge is as i am using the APEX 4.0.0.00.46 version, the APEX_IR package is not available in that version , Any other way we can achieve this  in Apex 4.0??
    Thanks
    -raj

  • Dynamic SQL report  on Oracle apex4.0

    Hi Everyone,
    I have two reports in one page.One is the Interactive and other is Sql report. Based on the selection of the row(using checkbox) in the interactive report, the sql report has to display the selected columns.
    Note :The report has to be loaded whenever a row is selected and without submitting a button
    Can anyone please suggest?
    I am using oracle Apex4.0
    Regards
    Raj

    I believe you store the values in the checkboxes. For example, your Interactive Report query looks like:
    SELECT '<input type=checkbox value='||OBJID||' />' AS CHECKBOX, T.*
    FROM SOME_TABLE T
    and in "Report Atributes" the CHECKBOX is displayed as "Standard Report Column".
    *1.Create a hidden check list input field.*
    It will store a list values of selected checkboxes. make it long enough, eg. 1000.
    Let's say the input name is: P000_X_CHECK_LIST
    *2. Create Dynamic Action*
    This dynamic action is supposed to fill in the P000_X_CHECK_LIST with a list of values, separated by ":" character.
    These values will be an input for the SQL report.
    Name: Update Check List
    Event: Change
    Selection Type: jQuery Selector
    jQuery Selector: input:checkbox
    Action: Set Value
    Set Type: JavaScript Expression
    function check_list() {
    var n = "";
    $(":checked").each( function () {
    n = n + (n === "" ? "" : ":") + $(this).val();
    return n;
    check_list();
    Selection Type: Item(s) - P000_X_CHECK_LIST
    *3. Adjust the "SQL report" query with this magic formula*
    AND SEARCHED_ITEM IN (
    SELECT item
    FROM (SELECT REGEXP_SUBSTR (str, '[^:]+', 1, LEVEL) item
    FROM (SELECT :P000_X_CHECK_LIST str
    FROM DUAL)
    CONNECT BY LEVEL <= length (regexp_replace (str, '[^:]+')) + 1)
    for example:
    SELECT O.*
    FROM SOME_OTHER_TABLE O
    WHERE SEARCHED_ITEM IN (
    SELECT item
    FROM (SELECT REGEXP_SUBSTR (str, '[^:]+', 1, LEVEL) item
    FROM (SELECT *:P000_X_CHECK_LIST* str
    FROM DUAL)
    CONNECT BY LEVEL <= length (regexp_replace (str, '[^:]+')) + 1)
    *4. Adjust the Dynamic Action:*
    Advanced: Event Scope: "live"
    *5. Add one more True action to the Dynamic Action:*
    Action: Refresh
    Selection type: Region
    Region: The region of the "SQL report".
    Volia!
    Best regards,
    Krzysztof

  • Item Values Not Set - Dynamic SQL Fails to Parse.

    ** Think I've fixed this **
    (By simply defining some page computations I was able to set the item values to some default. Please don't feel the need to reply :-))
    I have a page consisting of 5 report parameters and a report, all in one region, 4 parameters are LOVs and one is a text field which in the query are all compared to table column values. The report region type is SQL Query(PL/SQL function body returning SQL Query).
    If I load the page in a new session with default values for the LOVs as '%' and a null text field, I get the following error message:-
    failed to parse SQL query:
    ORA-00936: missing expression
    If I examine the session state, I see that none of the parameter values are set, which is probably why the dynamic sql is failing.
    If I set one of the parameters to something, eg. choose another value in an LOV or type some text in the text field, and re-run the report, it executes without error.
    What's the easiest way to fix this, is it to set the page items to some specific values when the page is first loaded? If so how do I do that? I'm not having much luck creating some process to do it.
    All help appreciated.
    Ian
    Message was edited by:
    Ian_F

    Hi Ian,
    Did you already try to put a default value for that lov?
    Or try to do a computation before header?
    Thanks,
    Dimitri
    -- http://dgielis.blogspot.com
    -- http://apex-evangelists.com

Maybe you are looking for

  • Losing hyperlinks in PDF

    When I upgrade a Old Pages document to New Pages 5, everything looks fine until I export to a PDF.  Suddenly, I lose all my hyperlinks.  I really need this function to work, any suggestions? Thanks HCrockett

  • Boot fails / goes straight to grub command line

    Fair warning: this is gonna be the worst request for help ever, but I'm stranded with a phone and a busted laptop. So, as the title suggests my laptop goes straight to the grub command line.  Having never dealt with this, I'm not really sure how to g

  • How to create an xml to load swf files in sequence?

    hello everyone I'm new in web design... I know how to animate in flash, using timeline, frames, layers, twins and so on... But I want to move forward so I want to create a xml to load swf files in sequence and in loop. Each swf file has 8 seconds.You

  • How to create Confirmation Item QUANTITY during Runtime

    Hi Experts, I am trying to create Confirmation ITEM with QUANTITY during runtime. I have successfully created item using CRM_ORDERADM_I_MAINTAIN_OW however it doesnot have scheduling_i structure which hold QUANTITY. I tried with CRM_ORDER_MAINTAIN_MU

  • IOS 7 can't find my air print printer where iOS 6 could. Is there a fix?

    Air print worked with iOS 6 but not with iOS 7. Is there a fix?