Dynamic SQL report on Oracle apex4.0

Hello world

I have two reports on a single page. One is the Interactive and another report. Sql based on the selection of the line (using the check box) in the interactive report, sql report should display the selected columns.

Note: the report must be loaded every time that a line is selected and without subjecting it to a button

Can someone please suggest?

I'm using oracle Apex4.0

Concerning
REDA

I think that you are storing the values in the boxes. For example, your interactive report query looks like:

SELECT '"AS CHECKBOX, T.*.
OF UNE_TABLE T

and in 'Attributes of report', the CHECKBOX is displayed under "Standard report column.

* 1 a control list hidden input champ.*
It will store a selected values of list of checkboxes. If it is long enough, for example. 1000.
Let's say that the entry name is: P000_X_CHECK_LIST

* 2. Create a dynamic Action *.
This dynamic action is supposed to fill the P000_X_CHECK_LIST with a list of values, separated by ': ' character.
These values will be an entry for the SQL report.

Name: updated checklist
Event: change
Selection type: jQuery Selector
jQuery Selector: input: checkbox

Action: Set

Set type: Expression JavaScript

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. Set the query "SQL report" with this magic formula *.

AND SEARCHED_ITEM IN)
SELECT the item
FROM (SELECT REGEXP_SUBSTR (str, ' [^:] +', 1, LEVEL) point)
FROM (SELECT: P000_X_CHECK_LIST str)
THE DOUBLE)
CONNECT BY LEVEL<= length="" (regexp_replace="" (str,="" '[^:]+'))="" +="">
)

for example:

SELECT O.*
OF SOME_OTHER_TABLE O
WHERE SEARCHED_ITEM IN)
SELECT the item
FROM (SELECT REGEXP_SUBSTR (str, ' [^:] +', 1, LEVEL) point)
FROM (SELECT *: P000_X_CHECK_LIST * str)
THE DOUBLE)
CONNECT BY LEVEL<= length="" (regexp_replace="" (str,="" '[^:]+'))="" +="">
)

* 4. Adjust the dynamic Action: *.

Advanced: Event scope: 'live '.

* 5. Add real action more dynamic Action: *.
Action: update
Selection type: region
Region: The region of the "SQL report.

Volia!

Best regards
Krzysztof

Tags: Database

Similar Questions

  • Column headings missing when the SQL report runs Oracle Conc ask

    Why the column headers for a sql report do not disappear when I try to run Oracle Manager of competing application work? If I copy and paste work in SQL * more and run it, the topics show on the report. Is there a setting I can update to allow these column headers to display?
    Example of what I get (No Headings)
    
    TOM SMITH          12345
    JANE DOE           34355
    
    Example of what I expect (with Headings)
    
    EMPLOYEE           EMPLOYEE NO
    TOM SMITH          12345
    JANE DOE           34355
    Thank you

    More likely:

    SET THE POSITION

    into force or / and

    SET PAGESIZE 0

    is in effect.

    SY.

  • Tables created in a stored procedure cannot be used with dynamic SQL? The impact?

    There is a thread on the forum which explains how to create tables within a stored procedure (How to create a table in a stored procedure , however, it does create a table as such, but not how to use it (insert, select, update, etc.) the table in the stored procedure.) Looking around and in the light of the tests, it seems that you need to use dynamic SQL statements to execute ddl in a stored procedure in Oracle DB. In addition, it also seems that you cannot use dynamic SQL statements for reuse (insert, select, update, etc.) the table that was created in the stored procedure? Is this really the case?

    If this is the case, I am afraid that if tables cannot be 'created and used"in a stored procedure using the dynamic SQL, as is the case with most of the servers of DB dynamic SQL is not a part of the implementation plan and, therefore, is quite expensive (slow). This is the case with Oracle, and if yes what is the performance impact? (Apparently, with Informix, yield loss is about 3 - 4 times, MS SQL - 4 - 5 times and so on).

    In summary, tables created within a stored procedure cannot be 'used' with dynamic SQL, and if so, what is the impact of performance as such?

    Thank you and best regards,
    Amedeo.

    Published by: AGF on March 17, 2009 10:51

    AGF says:
    Hi, Frank.

    Thank you for your response. I understand that the dynamic SQL is required in this context.

    Unfortunately, I am yet to discover "that seeks to" using temporary tables inside stored procedures. I'm helping a migration from MySQL to Oracle DB, and this was one of the dilemmas encountered. I'll post what is the attempt, when more.

    In Oracle, we use [global temporary Tables | http://www.psoug.org/reference/OLD/gtt.html?PHPSESSID=67b3adaeaf970906c5e037b23ed380c2] aka TWG these tables need only be created once everything like a normal table, but they act differently when they are used. The data inserted in TWG will be visible at the session that inserted data, allowing you to use the table for their own temporary needs while not collide with them of all sessions. The data of the TWG will be automatically deleted (if not deleted programmatically) when a) a commit is issued or b) the session ends according to the parameter that is used during the creation of the TWG. There is no real need in Oracle to create tables dynamically in code.

    I noticed that many people say that the "Creation of the tables within a stored procedure" is not a good idea, but nobody seems necessarily explain why? Think you could elaborate a little bit? Would be appreciated.

    The main reason is that when you come to compile PL/SQL code on the database, all explicit references to tables in the code must correspond to an existing table, otherwise a djab error will occur. This is necessary so that Oracle can validate the columns that are referenced, the data types of those columns etc.. These compilation controls are an important element to ensure that the compiled code is as error free as possible (there is no accounting for the logic of programmers though ;)).

    If you start to create tables dynamically in your PL/SQL code, so any time you want to reference this table you must ensure that you write your SQL queries dynamically too. Once you start doing this, then Oracle will not be able to validate your SQL syntax, check the types of data or SQL logic. This makes your code more difficult to write and harder to debug, because inevitably it contains errors. It also means that for example if you want to write a simple query to get that one out in a variable value (which would take a single line of SQL with static tables), you end up writing a dynamic slider all for her. Very heavy and very messy. You also get the situation in which, if you create tables dynamically in the code, you are also likely to drop tables dynamically in code. If it is a fixed table name, then in an environment multi-user, you get in a mess well when different user sessions are trying to determine if the table exists already or is the last one to use so they can drop etc. What headache! If you create tables with table names, then variable Dynamics not only make you a lot end up creating (and falling) of objects on the database, which can cause an overload on the update of the data dictionary, but how can ensure you that you clean the tables, if your code has an exception any. Indeed, you'll find yourself with redundant tables lying around on your database, may contain sensitive data that should be removed.

    With the TWG, you have none of these issues.

    Also, what is the impact on the performance of the dynamic SQL statements in Oracle? I read some contrasting opinions, some indicating that it is not a lot of difference between static SQL and SQL dynamic in more recent versions of Oracle DB (Re: why dynamic sql is slower than static sql is this true?)

    When the query runs on the database, there will be no difference in performance because it is just a request for enforcement in the SQL engine. Performance problems may occur if your dynamic query is not binding variable in the query correctly (because this would cause difficult analysis of the query rather than sweet), and also the extra time, to dynamically write the query running.

    Another risk of dynamic query is SQL injection which may result in a security risk on the database.

    Good programming will have little need for the tables of dynamically created dynamically or SQL.

  • How to pass the Record of entry to the dynamic SQL Code

    Hi all

    I am trying to run under Oracle applications API on the remote database using DB Link. I try to run using dynamic SQL. Part of the code is given below.

    DECLARE

    l_batch_info_rec wsh_picking_batches_pub.batch_info_rec;

    l_rule_id NUMBER;

    l_rule_name VARCHAR2 (240);

    l_batch_prefix VARCHAR2 (240);

    BEGIN

    l_batch_info_rec.document_set_id: = v_document_set_id;

    l_batch_info_rec.order_type_id: = v_order_type_id;

    l_batch_info_rec. Default_Stage_Subinventory: = v_default_stage_subinventory;

    l_batch_info_rec.pick_grouping_rule_id: = v_pick_grouping_rule_id;

    l_batch_info_rec.pick_sequence_rule_id: = v_pick_sequence_rule_id;

    l_batch_info_rec.autopack_level: = v_autopack_level;

    l_batch_info_rec.autopack_flag: = v_autopack_flag;

    l_batch_info_rec.ac_delivery_criteria: = v_ac_delivery_criteria;

    l_batch_info_rec.backorders_only_flag: = v_backorders_only_flag;

    l_batch_info_rec.existing_rsvs_only_flag: = v_existing_rsvs_only_flag;

    l_batch_info_rec.customer_id: = v_customer_id;

    l_batch_info_rec.order_header_id: = v_header_id;

    l_batch_info_rec.from_scheduled_ship_date: = NULL;

    l_batch_info_rec.organization_id: = v_organization_id;

    l_batch_info_rec.include_planned_lines: = v_include_planned_lines;

    l_batch_info_rec.autocreate_delivery_flag: = v_autocreate_deliveries_flag;

    l_batch_info_rec.autodetail_pr_flag: = v_autodetail_pr_flag;

    l_batch_info_rec.allocation_method: = 'I ';

    l_batch_info_rec.pick_from_locator_id: = NULL;

    l_batch_info_rec.auto_pick_confirm_flag: = 'n';         -The value manually to run Transact order

    l_batch_info_rec.autopack_flag: = 'n';         -Manually configure to perform the manual packaging

    l_rule_id: = NULL;

    l_rule_name: = NULL;

    l_batch_prefix: = NULL;

    v_sqlstmt1: = ' START

    wsh_picking_batches_pub.create_batch' | g_db_link | "(1.0,

    fnd_api.g_true,

    fnd_api.g_true,

    : l_return_status,.

    : l_msg_count,.

    : l_msg_data,.

    : l_rule_id,.

    : l_rule_name,.

    : l_batch_info_rec,.

    : l_batch_prefix,.

    : p_new_batch_id

    );

    END;';

    --

    EXECUTE IMMEDIATE V_sqlstmt1

    With the HELP OF THE l_return_status,.

    ON l_msg_count,.

    ON l_msg_data,.

    BY l_rule_id,

    BY l_rule_name,

    BY l_batch_info_rec,

    BY l_batch_prefix,

    OUT p_new_batch_id;

    --

    END;

    After you run this script, I get below error "PLS-00457: expressions must be SQL types ' for variable l_batch_info_rec which is of type record. can someone please guide me how can I pass variable type dynamic SQL record.

    Thank you

    Priyanka

    Food for thought:

    On remote db:

    SQL > create or replace
    package 2 pkg
    3 is
    4 type r_type is (record
    Number 5,
    6 name varchar2 (10)
    7                            );
    (p) 8 procedure
    9 p_rec in r_type,
    10 p_out out varchar2
    11                  );
    12 end;
    13.

    Package created.

    SQL > create or replace
    package 2 body pkg
    3 is
    4 procedure p)
    5 p_rec in r_type,
    6 p_out out varchar2
    7                  )
    8 is
    9 start
    10 p_out: = "ID = ' |" p_rec.ID | 'Name =' | p_rec. Name;
    11 end;
    12 end;
    13.

    Package body created.

    SQL >

    On local db:

    SQL > set serveroutput on
    SQL > declare
    v_rec 2 pkg.r_type@pdb1sol12;
    3 v_out varchar2 (50);
    4 start
    v_rec.ID 5: = 1;
    6 v_rec.name: = 'XXX ';
    7 immediate execution"
    8                        begin
    9 pkg.p@pdb1sol12 (: 1,: 2);
    10                        end;'
    11 using v_rec,
    12 v_out;
    13 dbms_output.put_line (v_out);
    14 end;
    15.
    using v_rec;
    *
    ERROR on line 11:
    ORA-06550: line 11, column 20:
    PLS-00457: expressions must be SQL types
    ORA-06550: line 7, column 5:
    PL/SQL: Statement ignored

    SQL > declare
    2 number of v_id: = 1;
    3 v_name varchar2 (10): = 'XXX ';
    4 v_out varchar2 (50);
    5. start
    6 immediate execution"
    7 report
    8 v_rec pkg.r_type@pdb1sol12.
    9                        begin
    10                            v_rec.id  := :1;
    11 v_rec.name: =: 2;
    12 pkg.p@pdb1sol12 (v_rec,: 3);
    13                        end;'
    14 using v_id,
    15 in v_name,
    16 v_out;
    17 dbms_output.put_line (v_out);
    18 end;
    19.
    ID = 1 name = XXX

    PL/SQL procedure successfully completed.

    SQL >

    SY.

  • SQL report

    How can I make the Apex SQL report that follows (two versions)?

    Thank you very much.

    Participation of students in the meetings.

    Students = Aris, Maria

    Meetings = 1, 2, 3 (2014-1-5, 15-1-2014 and 2014-1-25 respectively).

    Participation = 0/1 (absent/present).

    __________________________________________

    Report version 1

    Meeting 1 meeting 2 3

    1 1 ARIS 0

    Maria 1 0 0

    __________________________________________

    Report version 2

    Meeting 1 meeting 2 3

    2014 1-5 15-1-2014 2014-1-25

    1 1 ARIS 0

    Maria 1 0 0

    __________________________________________

    Here's the diagram:

    create table students

    (

    primary key not null ID number,

    name varchar2 (80)

    );

    create table meeting

    (

    primary key not null ID number,

    date of meeting_date

    );

    create the table student_meeting

    (

    primary key not null ID number,

    student_id number of non-null reference student (id),

    meeting_id number of non-null reference meeting (id),

    number of presences,

    check (presence in (0, 1))

    );

    insert into values student (11, "Aris");

    insert into values student (12, 'Maria');

    Insert in the encounter of the values (1, '' 2014-01-05);

    insert into values of meeting (date 2, '' 2014-01-15).

    Insert in meeting values (3, '' 2014-01-25).

    insert into student_meeting values (101, 11, 1, 1);

    insert into student_meeting values (102, 11, 2, 1);

    insert into student_meeting values (103, 11, 3, 0);

    insert into student_meeting values (104, 12, 1, 1);

    insert into student_meeting values (105, 12, 2, 0);

    insert into student_meeting values (106, 12, 3, 0);

    commit;

    What you want is called a matrix or pivot table dynamic PivotTable report... Take a look at this link RPF (as long as you eon ar 11g for a database...) for example: Vishal blog: methods of creating matrix in Oracle APEX report

    Thank you

    Tony Miller
    Software LuvMuffin
    Ruckersville, WILL

  • Dynamic SQL with dynamic identifiers

    Oracle 10gXE

    I have a table that is used to track student attendance. If the student is present on a given day, a record is inserted with the student ID and the date they frequented.

    presence of DESC
    Name of Type Null
    --------------- -------- ------
    ID NOT NULL NUMBER
    NUMBER OF STUDENT_ID
    SITE_ID NUMBER
    DATE OF ATTENDANCE_DATE

    I want to view a report (in TOP) which shows all students for a given site, the days when school was in session for this month (not Saturday, Sunday) and a X for the student who participated in that day or a null value if they do not have.

    ID # FNAME LNAME 3 4 5 6 7 10
    38754636 POE JANE X X X
    81248754 DOE KAYLA X X X X X
    43127409 RAO JOHN X X X X X

    In this example, days 3 and 7 of the month are from Monday to Friday and 8-9 have been excluded because they are on Saturday and Sunday.

    I am trying to find a way to dynamically generate a query for any month/year and returning to a report. The obstacle is that given that I don't know in advance which days in a month will be excluded, the identifiers in my select statement are not fixed.

    I found a query that returns a list of day numbers and dates for a given month. It looks like this:

    SELECT LEVEL lv, TO_DATE (TO_CHAR (LEVEL, '09')
    || TO_CHAR (EXTRACT (TO_DATE('01-SEP-11') MONTHS), '09')
    || To_char (EXTRACT (TO_DATE('01-SEP-11') YEAR), ' 9999'), 'dd.mm.yyyy') mon_day
    OF double WHERE ROWNUM < = EXTRACT (DAY OF LAST_DAY (TO_DATE('01-SEP-11')))
    CONNECT BY LEVEL = ROWNUM

    I combined this request with another brings my student attendance data and results that pivots in what I need. Then, I created a function that accepts the month and year as parameters and creates the combined request.

    SELECT c.ID student_id, c.last_name, c.first_name,.
    MAX (decode (mon_day, ' 01 - SEPT.-11', 'X', NULL)) '1', MAX (decode (mon_day, ' 02 - SEVEN.-11', 'X', NULL)) '2 ',.
    MAX (decode (mon_day, ' 05 - SEPT.-11', 'X', NULL)) '5', MAX (decode (mon_day, ' 06 - SEPT.-11', 'X', NULL)) "6."
    MAX (decode (mon_day, ' 07-SEP-11', 'X', NULL)) '7', MAX (decode (mon_day, ' 08 - SEPT.-11', 'X', NULL)) "8."
    MAX (decode (mon_day, ' 09 - SEPT.-11', 'X', NULL)) '9', MAX (decode (mon_day, 12-SEP-11', 'X', NULL)) "12."
    MAX (decode (mon_day, 13-SEP-11', 'X', NULL)) '13', MAX (decode (mon_day, 14-SEPT-11', 'X', NULL)) "14."
    MAX (decode (mon_day, 15-SEP-11', 'X', NULL)) '15', MAX (decode (mon_day, 16-SEP-11', 'X', NULL)) "16."
    MAX (decode (mon_day, 19-SEP-11', 'X', NULL)) '19', MAX (decode (mon_day, 20-7.-11', 'X', NULL)) "20."
    MAX (decode (mon_day, 21-SEP-11', 'X', NULL)) "21", MAX (decode (mon_day, 22-SEP-11', 'X', NULL)) '22 ',.
    MAX (decode (mon_day, 23-SEP-11', 'X', NULL)) '23', MAX (decode (mon_day, 26-SEP-11', 'X', NULL)) "26."
    MAX (decode (mon_day, 27-SEP-11', 'X', NULL)) '27', MAX (decode (mon_day, 28-SEP-11', 'X', NULL)) "28."
    MAX (decode (mon_day, 29-SEP-11', 'X', NULL)) '29', MAX (decode (mon_day, 30-SEP-11', 'X', NULL)) '30 '.
    (SELECT level lv, TO_DATE (TO_CHAR (LEVEL, '09')
    || TO_CHAR (EXTRACT (TO_DATE('01-SEP-11') MONTHS), '09')
    || To_char (EXTRACT (TO_DATE('01-SEP-11') YEAR), ' 9999'), 'dd.mm.yyyy') mon_day
    OF double WHERE ROWNUM < = EXTRACT (DAY OF LAST_DAY (TO_DATE('01-SEP-11')))
    CONNECTION LEVEL = ROWNUM) a, b of attendance, student c
    WHERE to_char(MON_DAY,'D') NOT IN (1.7)
    AND A.mon_day = b.attendance_date
    AND b.student_id = c.ID
    Group of c.ID, student_id, c.last_name, c.first_name

    Now I'm stuck on what I can pass this request in to get my result. What I've read, dynamic SQL method 4 would work if I incorporate Pro/C. I hope this isn't my only option. I have considered to try to do this in a function table in pipeline, but since the columns returned are not known in advance, I can't create a corresponding data type.

    I'm starting to wonder if I forgot a simpler method to achieve this.

    Published by: David Sumner on April 12, 2012 18:52

    Ignoring the actual query and looking at the dynamic SQL part of the question.

    There are 3 ways to run a dynamic select SQL in PL/SQL code.

    immediate execution requires a fixed number of bind variables, linking him in position and translates a single implicit output cursor extraction - requiring the projection of cursor to be known at the time of coding.

    REF CURSOR are essentially the same - the only exception being that it requires an extraction explicit coding process output cursor.

    DBMS_SQL differs in all of these respects. The connection is by name and not position. The connection is dynamic. Projection of the cursor must not be known at the time of coding. It is dynamically determined at runtime and fetch offers of release of the cursor with the projection of unknown SQL - coding time.

    Apex uses DBMS_SQL internally (in fact he uses DBMS_SYS_SQL properly run dynamic and specific patterns of Oracle SQL, as if a session connected as a scheme runs the SQL code). This allows the Apex to take a dynamic SQL that you enter a region (which can contain a variable number of bind variable), run it and make the projection of the cursor as an HTML report.

    Apex supports in turn also dynamic SQL - what you (Apex developer) to provide a dynamic SQL code for a region, instead of you having to provide SQL fixed (with bind variable) for the region in question.

    As Apex creates DBMS_SQL sliders, it doesn't have your SQL as a ref cursor or cursor DBMS_SQL. All they need is the source of the SQL statement. And that's what you create dynamically.

    So in the Apex, dynamic SQL means using a function from PL/SQL to return the source for Apex SQL analyze like a slider DBMS_SQL - instead of coding the source SQL statement in a fixed statement.

    So, using the option of function for an area considered in the Apex, allows you to provide the following in the code that must run to get the SQL statement for the report Apex (Apex running this as a dynamic function that returns a string):

    --// return the dynamic SQL for the report region
    return(
      case
        when :P1_OPTION = 1 then
          'select * from emp'
    
        when :P1_OPTION = 2 then
          'select * from dept where dept_id = :P1_DEPT_ID'
      end
    );
    

    You can also write a PL/SQL function that is stored in the database and call this function so that it can determine what is the dynamic SQL source code statement. For example

    --// calling database function to return the dynamic SQL for the report region
    return(
      GetDynamicReportSQL( page => 1, option => :P1_OPTION )
    );
    

    Dynamic SQL is fully supported by Apex - but does not require that you, the developer, to create the dynamic cursor and treat the dynamic linking and dynamic recovery of this slider.

    All you have to do is to provide the source code of this dynamic SQL (including the bind variable) to the Apex and it will do the whole thing from cursor for you.

  • Dynamic SQL in APEX

    Hey everyone, I'm trying to understand how to use dynamic sql statements in Application Express. Specifically, I'm trying to write a query using substitution/bind variables. I don't know if you need a description of the application or not, but here's the query that will run in sqlplus:
    ACCEPT     file_id     PROMPT     "Enter the file_id (a number, e.g. 3): "
     
    -- Preliminary Query, to set table_name
     
    COLUMN     reference_id_col     NEW_VALUE     reference_id
    COLUMN     table_name_col     NEW_VALUE     table_name
     
    SELECT  f.reference_id          AS reference_id_col
    ,           t.reference_table       AS table_name_col
    FROM      aa_files     f
    JOIN     aa_type     t     ON     f.file_type     = t.type_id
    WHERE     f.file_id     = &file_id
    ;
     
    --     Main Query
     
    SELECT  * 
    FROM     &table_name
    WHERE      reference_id     = &reference_id
    ;
    There are three substitution variables, reference_id & file_id and & table_name. My basic setup is that I have a table full of table names, so I ask her to get a table name in a variable, then query this table for my data.

    I work inside the window of SQL commands to try to find the proper syntax to make this work in the APEX. I'm pretty sure that APEX does not allow the use of substitution variables, because they are one thing on the side of client SQL more right?

    I'm still a student, so I'm not known and Oracle Application Express, but reading the documentation of the APEX and the Googling, I tell myself that bind variable should be able to do this for me, but I don't know how. I searched for some examples or documentation on the use of dynamic SQL statements in the APEX, but I could not find anything. I'm sure I could do this using a PL/SQL block, but I'd rather do it in pure SQL if possible.

    So if someone could help me or giving me an example of syntax I would have to use to write a query that is running in Application Express, or could direct me to the literature on the use of dynamic sql statements in Application Express, it would be greatly appreciated!

    If you need more information on my application, I can post my create table statements and some inserts sample data, if that would be helpful.

    Thank you!

    Published by: username, June 21, 2010 07:34

    OK, so one of the great things about SQL is your ability to choose what columns you want to include in your result set. You don't have to use all of them. You can do this in two ways: with dynamic SQL or individual areas for each type of file. This will depend on your use as to how many types different files will be added each day on which you want to go with.

    If you go with dynamic SQL (and because you don't know until run time what columns you want to use, it is an appropriate use), you will need to build your query based on the file type. Something like this:

    declare
      qry_type  VARCHAR2(10);
      sql_qry    VARCHAR2(4000);
      qry_select  VARCHAR2(500);
      qry_from   VARCHAR2(100);
      qry_where  VARCHAR2(400);
      qry_order   VARCHAR2(100);
    begin
      qry_type  :=  :PX_QRY_TYPE;
      --Build the SELECT clause
      qry_select   := 'select a.FILE_NAME, a.FILE_NAME, a.FILE_TYPE, a.LOCATION';
      CASE qry_type
         WHEN 'PDF' THEN qry_select   := qry_select || ', pdf.DATE_MODIFIED, pdf.SUMMARY, pdf.AUTHOR';
         WHEN 'XLS' THEN qry_select   := qry_select || ', xls.DATE_MODIFIED, xls.SUMMARY, xls.TOTAL_VALUE';
         ...
      END CASE;
      --Build the FROM clause
      qry_from    := ' from AA_FILE a, AA_FILETYPE_PDF pdf, AA_FILETYPE_XLS xls, AA_FILETYPE_PHOTO p';
      --Build the WHERE clause
      qry_where  := ' where a.FILE_ID = pdf.FILE_ID (+)';
      qry_where  := qry_where || ' and a.FILE_ID = xls.FILE_ID (+)';
      qry_where  := qry_where || ' and a.FILE_ID = p.FILE_ID (+)';
      --Build the ORDER BY clause
      qry_order  := '';
      --Put it all together
      sql_qry   := qry_select || qry_from || qry_where || qry_order;
      EXECUTE IMMEDIATE sql_qry;
      ...
    end;
    

    Now this does not cover the addition of new file types. I still think you're going to be better off planning for as much as you can and handle manually creating additional tables, but this is going to be to you. I know you are trying to generate code to do everything for you, but when it comes to databases, I found that the creation of objects can quickly become uncontrolled if you're not very careful. These are going to be permanent, not temporary memory built database objects. Just a word of warning.

    If you decide to go with a region and by file type, it does not require nearly as much work. Simply create a report region based on the view and set the conditional display based on your file type.

      select * from V_FILES_PHOTO
       where FILE_ID = :PX_FILE_ID;
    
    condition:  FILE_TYPE = 'PDF'
    

    While you will need to add a region again every time that you add a new file type, once again, the question that arises is: file types how are you really going to have to worry? If you're talking about a dozen, I would like to do things manually. If you're talking about a hundred, it's maybe worth trying to find a method of programming. It is your call to make.

  • At the top of the PAGE Sql report SQL_ID

    Hello

    on 5.6.4 we generate report TOP SQL for guarded Oracle DB. But SQL_ID isn't in them. Any way to make them?

    Thank you.

    I don't see anything exactly like 'SQL_ID"in properties DBO_Top_Sql (attached).

    Have you seen this property in a Foglight dashboard? If so, you should be able to add to the DBO_Top_Sql report.

    Kind regards

    Brian Wheeldon

  • How to extract the names of columns in dynamic SQL

    Hi all

    Is it possible to extract all the names of columns in a dynamic query?

    In my case according to the user selections that my query will get changed (number of the column, column name and tables that everything can vary).

    So now, is it possible to retrieve all the column names of the dynamic query generated?

    I am using Oracle 11g (11.2.0.4)

    Thank you

    Shaz

    Re: Dynamic Extraction on dynamic Sql

  • How to adjust column widths individual classic SQL report

    Hello

    I use Oracle APEX v4.2 with IE8 browser and basically tries to adjust widths of individual columns in my classic SQL report. Basically, I have three columns I want to spacing, so that the width of the entire region for the report is used, but am not sure how to proceed.

    I drilled in individual columns and specified the column widths as the element, but in vain.

    Would appreciate help on how to do this for each column and hope that I do not need to change the model of report (if possible).

    Thank you.

    Tony.

    Tony F. says:

    I use Oracle APEX v4.2 with IE8 browser and basically tries to adjust widths of individual columns in my classic SQL report. Basically, I have three columns I want to spacing, so that the width of the entire region for the report is used, but am not sure how to proceed.

    There is an element of uncertainty in what we suggest as well, because you have not specified the theme and the report of model that is used. This information is required for any question of formatting or the visual layout.

    I drilled in individual columns and specified the column widths as the element, but in vain.

    Report in some themes templates may be missing in the #COLUMN_WIDTH substitution string # required for use of the declarative column widths, as shown here: Re: width of column in reports

    I don't know why it would be missing from a theme of so-called "modern" (perhaps the lack of documentation affects even the Oracle theme designers), but you can add it to the models listed in this thread.

    Width of the element applies only to controls on a form in a table.

    Would appreciate help on how to do this for each column and hope that I do not need to change the model of report (if possible).

    This can be done using selectors CSS attribute (for the themes of quirks mode non-traditional, because you are using a legacy version of IE). Add a style sheet in CSS Inline property page:

    #ALIAS,
    td[headers="ALIAS"] {
    width: 40%;
    }
    

    where the ALIAS value in the attribute selector matches the required column alias, and the width property specifies the column dimension required and the units.

    Note that the percentage widths will be compared to the width of the report table. Therefore, it may be necessary to also specify widths (100%) for the table of report and its components. Exactly how is based on the report, the region and the page templates and theme used, information that was not provided.

  • Hyperion at level 11.1.1.3 to Hyperion 11.1.2.3 with change of database SQL server and Oracle DB

    I am upgrading the Hyperion 11.1.1.3 environment in new infrastructure which include (HFM, Shared service, FDM and Hyperion reporting). The 11.1.1.3 had SQL Server repository, now we are making everything on the Oracle database repository. Can I directly use the LCM to migrate all of the artifacts of 11.1.1.3 11.1.2.3. Can someone advise how best to do the migration. Y at - it something I should look. Something that fail often I should look.

    There are a number of ways to achieve what you're trying to do and it may depend on the number of products/applications and the complexity of the environment.

    There are also ways to migrate to a SQL database to Oracle with different success rates depending on what is involved.

    See you soon

    John

    http://John-Goodwin.blogspot.com/

  • SQL report should look to the updating of the continuous element

    Hello

    I have a question about how it is possible to do a SQL report that looks like the element continuous is changed in the browser.

    I now have this SQL query:

    Select x.first_name, x.Last_name, it. Nom_element, ui.user_item_ID, ui.item_ID, ui.employee_number

    of APEX_EBS_ACTIVE_LIST x,.

    USER_ITEMS ui,

    ELEMENT that she

    where x.employee_number = ui.employee_number

    and it.item_id = ui.item_id

    and ui.employee_number =: p7_employee_number

    ORDER BY x.last_name

    I have Apex page 7 a popup lov (P7_employee_number. When selection here the employee_number I want that the SQL query displays at the same time the report below on the page with the information on the employee.

    Does anyone know how this is possible? I use APEX 4.2

    Thank you!


    Concerning
    ELCO

    ELCO

    On point page p7_employee_number have a dynamic action with the event 'change '.

    Have an action "Refresh" with as affected the region of you're sql statement.

    Make sure that the p7_employee_number element is declared as "Elements of Page to submit" to the region.

    Which will refresh the report whenever the item is changed.

    It is with the section of the page and the report are not on the same page apex.

    Nicolette

  • Quoted string inside dynamic SQL

    Hello
    My version of db: database Oracle 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production

    I run this code in a proc, and it goes to the exception block without running the code below:
    EXECUTE IMMEDIATE
        'SELECT LISTAGG (entitlement, '''','''') WITHIN GROUP (ORDER BY entitlement)
        FROM XMLTABLE (                                 
            ''''/ROWSET/ROW/ENTITLEMENTS/ENTITLEMENT''''      
            PASSING XMLPARSE (DOCUMENT p_xmldoc)        
            COLUMNS ENTITLEMENT VARCHAR2(30) PATH ''''.'''')'                                    
        INTO v_str;
    I made a mistake with quoted strings and I have tried different combinations, but anyway his does not work.
    THA real piece of code is below, whick I'm trying to run immediately in a string
    SELECT LISTAGG (entitlement, ',') WITHIN GROUP (ORDER BY entitlement)                              
                                            FROM XMLTABLE (                                 
                                                '/ROWSET/ROW/ENTITLEMENTS/ENTITLEMENT'      
                                                PASSING XMLPARSE (DOCUMENT p_xmldoc)        
                                                COLUMNS ENTITLEMENT VARCHAR2(30) PATH '.')
    p_xmldoc sample is less than
    '<?xml version="1.0"?>
    <ROWSET>
    <ROW>
    <ENTITLEMENTS>
      <ENTITLEMENT>AMEX</ENTITLEMENT>
      <ENTITLEMENT>JCB</ENTITLEMENT>
    </ENTITLEMENTS>
    </ROW>
    </ROWSET>'
    My goal is to get
    v_str = AMEX, JCB
    Please advice.

    Hello

    Use the notation by Q.
    Assuming that the dynamic control does not contain a right brace immediately before a single quote, you can say:

    
    sql_txt := Q'{SELECT LISTAGG (entitlement, ',') WITHIN GROUP (ORDER BY entitlement) ...}';
    dbms_output.put_line (sql_txt || ' = sql_txt');
    -- EXECUTE IMMEDIATE sql_txt;
    

    With Q-rating, you can't excape double, or otherwise single quotes.

    When you write code dynamic SQL, put the full command in a single VARCHAR2 variable (such as the sql_txt above). During the test, display it. If it looks right, then a comment the line where actually run you it.

  • Change the line color of the standard SQL report

    Hello

    I'm trying to follow this post to change the color of a line in the APEX SQL report. Change the color of line - report SQL Oracle APEX

    It is a little outdated and trying to figure out how to get to this page: http://img7.imageshack.us/img7/4782/columntemplate.jpg 4.2 APEX where I can put under condition of background color.


    I use Theme 13 (inheritance) and make a copy of the report area. Published, but could not find an equivalent section of this screenshot of the apex 3.1.

    Any help appreciated.

    William Wallace says:

    I'm trying to follow this post to change the color of a line in the APEX SQL report. Change the color of line - report SQL Oracle APEX

    It is a little outdated and trying to figure out how to get to this page: http://img7.imageshack.us/img7/4782/columntemplate.jpg 4.2 APEX where I can put under condition of background color.

    I use the theme 13 (legacy)

    Ugh.

    and make a copy of the report area. Published, but could not find an equivalent section of this screenshot of the apex 3.1.

    This suggests that you look at the definition of region page, or even simply the definition of region model. What you need here is a copy of the report model.

    1. go in Home > Application Builder > Application > shared components > models.

    2. Select theme 13 theme filter, the Filter Type reports and click OK.

    3. create a copy of the Standard report model by using the icon copy in the list.

    4. Select the new report template and edit it as shown in the thread linked to above, paying special attention to the content of the second post. (It is of generic column template definition page that contains the section in the screenshot).

  • Interlink with Sql server and Oracle

    Hello

    We have some data in SQL Server.
    We need to link SQL Server and Oracle Database. To make reports in Oracle Apex.

    Please someone guide me to interconnect with Oracle database

    Kind regards
    Thérèse

    Therese,
    You can find more information on gateways in this available in My Oracle Support note-

    Note to master for the Oracle Gateway (Doc ID 1083703.1) products

    Kind regards
    Mike

Maybe you are looking for