Hiding SQL code in query

When you have executed a query, you are able to click the arrow and hide the SQL.
The system queries always run with this hidden, it appears to be not possible to do the same with user queries?
Sometimes the SQL code takes up a lot of the page so it is hard to view the results.
Does anyone know how to achieve this?

Julie,
As you have already aware, there is no other option to hide the SQL.  I don't think the query window size ever changes.  It is always the same whatever may be the length of your query.
Suda

Similar Messages

  • Hiding SQL statement in Query Result Window

    Hi everyone,
    Is it possible to hide the SQL statement from a query result window? This can usually be done by click the orange triangle that is positioned to the left of the SQL string box (to expand and collapse it). The System Queries have this box collapsed per default, is it possible to have this setup as default for all queries, including the custom? If so, please let me know where this can be done.
    Cheers

    You should do this only with SDK programming - dont allow to show the syntax. The next, but problematic way, is the code you have do inside stored procedure and call only this sp inside the query generator window - if you have there some input parameters, you should use filling variables before executing sp and get it as input parameters to sp.

  • Query SQL code gets deleted after export to Excel. "Query must have at least one destination field"

    Hi all,
    I'm getting really frustrated by this Access error. It happens when I export the result of a query through an Access macro to Excel, the first time it runs well but the next time, there is a chance that the query won't run and the error "Query
    must have at least one destination field" will be displayed. After that, I try to check the query SQL code and discover the code has vanished. I'm using simple Select query without joins, only "where", "group by" and "order by"
    statements.
    Thank you in advance for your help,
    Jesus 
    Edit:
    One of these queries are like the following (all of them are of this type):
    SELECT Field1, field2, field3, field4, field5, Sum(Field6) AS SumOfField6, Sum(Field7) AS SumOfField7
    FROM Table1
    WHERE Field6 is not null
    GROUP BY Field1, field2, field3, field4, field5
    Order By Sum(Field6) desc

    Hi Peter, 
    Thank you for your response, I updated the original question with one of the codes.
    Thanks,
    Jesus

  • APEX,PDF's, BI Publisher and SQL Query returning SQL code..

    I don't know if I should be posting this in this Forum or the BI Publisher forum, so I am posting in BOTH forums..
    I love APEX, let me say that first.. And appreciate the support offered here by the group, but am running int a confusing issue when BI Publisher tries to build a report from the above type APEX report..
    Here is my dilemma:
    I have a number of reports that are part of a Oracle package. They return an SQL Query back to a reports region on a page. I am having to deal with the column names returned are col01, col02..
    The issue I have is, when building the Application Level query to download the XML sample from in building RTF layouts in Word, you can not use this code, you MUST use a standard SQL Select.
    I have taken the sql from the function returning sql, and copied into the application query, supplying the required data values for bind variables being used in the query.
    An XML file is produced, and I use this to build the RTF format file that I load back into APEX and try to use it for the PDF rendering of the report. I can view the output as a PDF in the Word add on, but when I try using it with the report, it is returning an empty PDF file.
    Can anyone tell me what error log files on the bi publisher side I can look at to see what error is happening?
    Thank you,
    Tony Miller
    UTMB/EHN
    Title adjusted to allow people to know what I am talking about...
    Message was edited by:
    Tony Miller

    Tony,
    You can find the log as follows:
    - go to http://[yourserver]:[yourport]/em
    - logon to OC4J EM: oc4jadmin/[yourpassword]
    - click on "logs" at the bottom of the page
    - in the hgrid/tree, expand OC4J->home->Application
    xmlpserver
    - click on view log icon
    You can also observe what's going on in BI Publisher
    by going to the command prompt from where you started
    it.
    Or, as a third option, you can locate the file on
    your file system, depending on your setup, the path
    would be something similar to this:
    \oracle\product\10.2.0\bip\j2ee\home\application-deplo
    yments\xmlpserver\application.log
    With that said though, I don't expect you'll find
    much in there that would help with your particular
    problem. I suspect you either get no rows in your XML
    at runtime, due to some session state issues, or your
    XML structure does in fact not match your RTF
    template.
    I'm not quite following your problem description,
    i.e. when did you do what and are you associating
    your report layout with a report query or report
    region. So just some general notes, your query needs
    to be parseable at design-time, when exporting the
    XML, so that you get the XML file with the proper
    column names derived from your query. If you want to
    use your RTF template with a standard report region,
    you must export the XML file first using the advanced
    XML structure option. And of course the column names
    in your report query need to match the column names
    in your report region.
    Perhaps this helps you further diagnose what's going
    on, if you have additional information that could
    help, let me know. And if you could stage this on
    apex.oracle.com, I'd be happy to take a look.
    Regards,
    MarcMarc,
    Thanks for looking at this issue. Below find my remarks to your questions..
    Re: your query needs
    to be parseable at design-time, when exporting the
    XML, so that you get the XML file with the proper
    column names derived from your query.At the start of this process, the query code was a function in a package. The function was returning an SQL select statement, for a report region on a page. I took the select statement, built an application query to build a sample of the xml for BI Publisher desktop (Add-on for Word). The code was producing the usual Col01, Col02.. since at design time that is were the column names.
    When I then took the xml from this and built the rtf for loading into my APEX application.
    When testing the Application Query with this RTF report layout, I am getting PDF's. When using it with the report region sending an xml feed to BI Publisher I am getting nothing back.
    I have since taken the sql code and moved it back into the report region, and set the region to have a type of straight SQL Query. I have even tried to hard-code the parameters I was getting from the page to limit data returned.
    Is it possible to see the xml being produced by the APEX page?
    Re: Stage this on apex.oracle.com.. I would love to, but we would have HIPPA issues if I posted the data on a public website.
    Can I send you the RTF file and the xml file that the application query is creating to see if there something weird about them?
    Thank you,
    Tony Miller
    UTMB/EHN

  • TopLink - Get sql code of a Named Query.

    Hi everyone!
    I'm wrinting to yours because I want to insert into a register of a table of my database the sql code generated of a named query. I mean, I have a named query with sql code, and I want to get that sql with the parameters that I used to execute that query.
    What would I do to get that information..??..
    I'll be wainting your responses.
    Thanks!
    Greetings, Lucho!

    You might want to ask this on the TopLink Forum.
    TopLink has levels of logging that will provide you with the queries executed.
    That said, if you want to log each operation on a table at the database level, then maybe looking into the database audit features would make more sense.

  • How to 100% Protect PL/SQL Code By Wrapped in Oracle Database 10g R2

    Hello,
    Is Possible to 100% Protect PL/SQL Code By Wrapped in Oracle 10g R2 ?
    If it is not possible by wrap in oracle 10g R2,
    Please, let me suggest, how i will be able to 100% protect PL/SQL code in Oracle Database 10g R2.
    Because, I have lot of functions, procedures & package's in my project.
    Which is running in field filed.
    So, i have needed to protect 100%.
    Also, will i convert to al functions, procedures & package's to .pll file ?
    And .pll file to .plx file?
    Is it possible to convert .plx file to .pll file ?
    Please, let know any better solutions in this case....
    Regards
    Mehedi

    Hello,
    No, wrapping is not a 100% secure method. It could prevent your code from amateurs, but not from professional hackers. Look at the article http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/wrap.htm#BEHGBJAA
    It says: "•Wrapping is not a secure method for hiding passwords or table names.
    Wrapping a PL/SQL unit prevents most users from examining the source code, but might not stop all of them."
    Edited by: apiminov on 03.12.2012 3:23
    Edited by: apiminov on 03.12.2012 3:24

  • How to reference LEVEL in a TREE's SQL code

    Is it possible to somehow reference LEVEL in a tree's sql code so that you can use a decode statement to selectively create links on specific levels only i.e. NOT on the root level?
    e.g.
    select "CHILD_ID" id,
    "PARENT_ID" pid,
    "NAME" name,
    decode( LEVEL, 1, null,'f?p=' || :APP_ID || ':43:' || :APP_SESSION || '::::P43_CHILD_ID:' || CHILD_ID) link,
    null a1,
    null a2
    from TREETABLE
    order by name
    one solution I've implemented is to create a DB function e.g.
    create or replace function get_tree_level(v_child_id number) return number
    is
    v_level number(2);
    begin
    select level
    into v_level
    from TREETABLE
    where child_id=v_child_id
    start with child_id=1
    connect by prior child_id= parent_id;
    return v_level;
    end;
    and then use
    decode( get_tree_level(child_id) 1, null,'f?p=' || :APP_ID || ':43:' || :APP_SESSION || '::::P43_CHILD_ID:' || CHILD_ID) link,
    but this is too slow as I have quite a few records in the tree and takes too long to render
    regards
    Paul P

    OK I found a workaround after reading
    How to add URL to tree
    The view my tree is build on is constructed out of 3 unions and 4 "selects" ( the first select creates the ROOT NODE where "1" is also used as a hard coded foreign key (Parent_id), in the company table.)
    I just added a new column called tree_level to the query which is hard coded wrt its level on the hierarchy.
    e.g.
    CREATE OR REPLACE FORCE VIEW COMCONSTUTREE ("CHILD_ID", "PARENT_ID", "NAME","TREE_LEVEL") AS
    select 1 as child_id,to_number(null) as parent_id ,'Company' as name,*1 as tree_level* from dual
    UNION
    select COM_ID, 1, COM_NAME,2
    from company
    UNION
    select CON_ID,CON_COMPANY_ID, substr(con_name,instr(con_name,' ')+1) ||', '||substr(con_name,1,instr(con_name,' ')-1),3
    from contact
    UNION
    select STU_ID,STU_CONTACT_ID, STU_LAST_NAME||', '||STU_FIRST_NAME ,4
    from student;
    the tree code now becomes
    select "CHILD_ID" id,
    "PARENT_ID" pid,
    "NAME" name,
    decode( tree_level,1, null,'f?p=' || :APP_ID || ':43:' || :APP_SESSION || ':TREE:::P43_CHILD_ID:' ||CHILD_ID) link,
    null a1,
    null a2
    from COMCONSTUTREE"
    order by name

  • Can I have a PL/SQL code for LOV

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

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

  • Getting error while compiling this pl/sql code

    Hi,
    I am trying to execute the below block of pl/sql code and i encountering an error. i tried all possible combination of paranthesis and quotes. still giving error. can someone please help?
    IF inserting THEN
    pk_imdb_audit.p_ins_characteristic_a_t
    (in_'||rpad(column_name,35,' ')||'=> pk_imdb_audit.v_action_inserting,'
    WHEN max_col = column_id THEN
    in_'||rpad(column_name,35,' ')||'=> '||lower(in_col_value)||');'
    ELSE
    ' in_'||rpad(column_name,35,' ')||'=> '||lower(in_col_value)||','
    END text,
    table_name,
    column_id,
    2 disp_ord
    error snapshot:-
    ORA-06550: line 14, column 14:
    PLS-00103: Encountered the symbol "||rpad(column_name,35," when expecting one of the following:
    . ( ) , * @ % & | = - + < / > at in is mod remainder not
    range rem => .. <an exponent (**)> <> or != or ~= >= <= <>
    and or like LIKE2_ LIKE4_ LIKEC_ as between from using ||
    multiset member SUBMULTISET_
    The symbol "( was inserted before "||rpad(column_name,35," to continue.
    ORA-06550: line 15, column 13:
    PLS-00103: Encountered the symbol "WHEN" when expecting one of th

    Hi,
    here is a 'parseable' version of your query, but there is numerous ways to improve what you want to do (not sure even if the query is giving you what you're expecting from it):
    SELECT text
    FROM   (SELECT (CASE
                       WHEN min_col = max_col THEN    'CREATE OR REPLACE TRIGGER '
                                                   || SUBSTR(column_name,
                                                             1,
                                                             4
                                                   || 'aud
    AFTER INSERT
    OR UPDATE
    OF '
                                                   || column_name
                                                   || ',
    OR DELETE ON imdb.'
                                                   || table_name
                                                   || '
    FOR EACH ROW'
                       ELSE(CASE
                               WHEN min_col = column_id THEN    'CREATE OR REPLACE TRIGGER '
                                                             || SUBSTR(column_name,
                                                                       1,
                                                                       4
                                                             || 'aud
    AFTER INSERT
    OR UPDATE
    OF '
                                                             || column_name
                                                             || ','
                               ELSE(CASE
                                       WHEN max_col = column_id THEN    ' '
                                                                     || column_name
                                                                     || '
    OR DELETE ON imdb.'
                                                                     || table_name
                                                                     || '
    FOR EACH ROW'
                                       ELSE(CASE
                                               WHEN column_id IS NULL THEN    'CREATE OR REPLACE TRIGGER '
                                                                           || SUBSTR
                                                                                 (column_name,
                                                                                  1,
                                                                                  4
                                                                           || 'aud
    AFTER INSERT
    OR UPDATE
    OR DELETE ON imdb.'
                                                                           || table_name
                                               ELSE    ' '
                                                    || column_name
                                                    || ','
                                            END
                                    END
                            END
                    END
                   ) text,
                   table_name1 table_name,
                   column_id,
                   1 disp_ord
            FROM   (SELECT LOWER(REPLACE(column_name,
                                         'O_',
                                        )) column_name,                   /*changing O to O_*/
                           LOWER(REPLACE(t.table_name,
                                         '_A_',
                                        )) table_name,
                           LOWER(t.table_name) table_name1,
                           c.column_id,
                           MIN(column_id) OVER(PARTITION BY c.table_name) min_col,
                           MAX(column_id) OVER(PARTITION BY c.table_name) max_col
                    FROM   all_tab_columns c,
                           (SELECT object_name table_name
                            FROM   all_objects
                            WHERE  TRUNC(created) = TRUNC(SYSDATE)
                            AND    object_name = 'CHARACTERISTIC_A_T') t
    --AND object_name LIKE 'IMDB/_A/_%' ESCAPE '/') t /*commented this line for testing*/
                    WHERE  c.table_name(+) = t.table_name
                    AND    SUBSTR(column_name(+),
                                  1,
                                  2
                                 ) = 'O_'))
              /*changed the substring condition to match new changes*/
    UNION ALL
    SELECT (CASE
               WHEN min_col = column_id THEN    'DECLARE
    BEGIN
    IF inserting THEN
    pk_imdb_audit.p_ins_characteristic_a_t
    (in_'
                                             || RPAD(column_name,
                                                     35,
                                             || '=> pk_imdb_audit.v_action_inserting,'
               ELSE(CASE
                       WHEN max_col = column_id THEN    'in_'
                                                     || RPAD(column_name,
                                                             35,
                                                     || '=> '
                                                     || LOWER(in_col_value)
                                                     || ');'
                       ELSE    ' in_'
                            || RPAD(column_name,
                                    35,
                            || '=> '
                            || LOWER(in_col_value)
                            || ','
                    END
            END
           ) text /*,
           table_name,
           column_id,
           2 disp_ord*/
    FROM   (SELECT table_name,
                   column_name,
                   column_id,
                   min_col,
                   max_col,
                   in_col_value,
                   trg_header,
                      'in_'
                   || RPAD(column_name,
                           35,
                   || '=> '
                   || LOWER(in_col_value)
                   || ',' in_col
            FROM   (SELECT   LOWER(c.column_name) column_name,
                             LOWER(c.table_name) table_name,
                             c.column_id,
                             (CASE
                                 WHEN SUBSTR(column_name,
                                             1,
                                             2
                                            ) = 'N_' THEN
                                   /*changed the substring condition to match the new change*/
                                                            ':NEW.'
                                                         || REPLACE
                                                               (column_name,
                                                                'N_',
                                                                'N_'
                                            /*changed the condition to match new requirement*/
                                 WHEN SUBSTR(column_name,
                                             1,
                                             2
                                            ) = 'O_' THEN
                                   /*changed the substring condition to match the new change*/
                                                         'NULL'
                                 ELSE    ':NEW.'
                                      || REPLACE(column_name,
                                                 '_A_',
                              END
                             ) in_col_value,
                             LOWER(SUBSTR(column_name,
                                          1,
                                          3
                                         )) trg_header,
                             MIN(column_id) OVER(PARTITION BY c.table_name) min_col,
                             MAX(column_id) OVER(PARTITION BY c.table_name) max_col
                    FROM     all_tab_columns c
                    WHERE    c.table_name IN(
                                SELECT object_name
                                FROM   all_objects
                                WHERE  TRUNC(created) = TRUNC(SYSDATE)
                                AND    object_name = 'CHARACTERISTIC_A_T')
                    ORDER BY c.table_name,
                             c.column_id))

  • SQL Code not working in Forms Developer without Functions?

    Hi all,
    I've write this code into Forms at it's work correctly in SQL and the following error occurened
    The PL-SQL Code:
    DECLARE
         Product_Name Products.Name%TYPE;
         Most_Occurence NUMBER(10);
    BEGIN
         SELECT *
         INTO Most_Occurence, Product_Name
      FROM (SELECT   COUNT (returned_goods.ID) AS "Max Occurence", products.Name
      FROM Returned_Goods
      JOIN Products
      ON returned_goods.productId = products.Id
             GROUP BY returned_goods.productId, products.Name
             ORDER BY COUNT (returned_goods.ID) DESC)
    WHERE ROWNUM = 1;
    END;The error message (appears near JOIN Products) :
       Encountered symbol "PRODUCTS" when expecting one of the following:
          ), with group having intersect minus order start union where connectThanks in advance
    Edited by: ZiKaS on Dec 30, 2008 8:57 AM

    Now...obviously you can't use ansi join syntax in that forms module. So rewrite your query with
    FROM returned_goods, products
    WHERE returned_goods.productId = products.id
    hth

  • Conditional SQL in Report Query

    How can I code a conditional SQL in the Report query builder
    to include a WHERE clause parameter or not, depending on the value
    of a report parameter? Basically, what I want to do is:
    select field from table where x=1
    <cfif param.a eq 1>and a=1</cfif>
    Report builder does not like this, but I can't find any help
    on how to do this.

    I don't think CFML tags may be used like that in the SQL of
    report query. But then, I'm not very much into reports. If you're
    just out to get the result, then try
    select field from table
    where
    (x=1 and #param.a# <> 1) or (x=1 and #param.a#=1 and
    a=1)

  • Am facing this error sqlcode :-6502 while running sql code in plsql block

    Am facing this error sqlcode :-6502 while running sql code in plsql block.
    am using query :
    SELECT SUBSTR('123456DE789KL|987654321|B',1,INSTR('123456DE789KL|987654321|B','|')-1) FROM DUAL;
    CAN any body tell me why.

    BD_Fayez wrote:
    I've tried the following, but don't get any error.As I mentioned, most likely variable is too short:
    SQL> declare
      2  strSub varchar2(2);
      3  begin
      4  SELECT SUBSTR('123456DE789KL|987654321|B',1,INSTR('123456DE789KL|987654321|B','|')-1) into strSub FROM DUAL;
      5  dbms_output.put_line(strSub);
      6  end;
      7  /
    declare
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-06512: at line 4
    SQL> SY.

  • How to Code this Query

    Hello, I'm using Access and need to code this query on SQL and I have this problem:
    I have 3 tables: Movie, Actor, Acts_In
    Movie table has fields: Movie_ID, movie_name, actor_1, actor_2, director
    Actor table has fields: Actor_ID, first_name, last_name
    Acts_IN table has fields: Movie_ID, Actor_ID
    * actor_id and movie_id are primary keys
    I have to create a query that allows me to search for a director, giving me a list of actors that have worked with that director, and all the movies they have acted in.
    so far I have come up with this code, however:
    select actor.first_name, actor.last_name, movie_name
    from (actor inner join acts_in ON acts_in.actor_ID=actor.actor_id) inner JOIN movie
    ON acts_in.movie_ID=movie.movie_id
    group by actor.first_name, actor.last_name, movie_name;
    This code gives me a list of all actors and all movies they acted in, but it does not give me specific actors in respect to a specific director, adding
    where director="XYZ"
    does not work as it gives me all actors that have worked with director XYZ but not all movies they have acted in. 
    Thanks!

    Grump. You should have provided us example data and DML, like this:
    DECLARE @movies TABLE (movie_ID INT, movie_Name VARCHAR(50), director VARCHAR(75))
    DECLARE @actors TABLE (actor_ID INT, first_name VARCHAR(50), last_name VARCHAR(50))
    DECLARE @acts_in TABLE (movie_ID INT, actor_ID INT)
    INSERT INTO @movies (movie_ID, movie_Name, director) VALUES
    (1, 'Batman Returns', 'Tim Burton'),
    (2, 'Charlie and the Chocolate Factory', 'Tim Burton'),
    (3, 'Sweeney Todd', 'Tim Burton'),
    (4, 'Alice in Wonderland', 'Tim Burton'),
    (5, 'Edward Scissor Hands', 'Tim Burton'),
    (6, 'From Hell', 'Albert Huges')
    INSERT INTO @actors (actor_ID, first_name, last_name) VALUES
    (1, 'Danny', 'DeVito'),
    (2, 'Freddie', 'Highmore'),
    (3, 'Helena', 'Bonham-Carter'),
    (4, 'Johnny', 'Depp'),
    (5, 'Mia', 'Wasikowska'),
    (6, 'Micheal', 'Keaton'),
    (7, 'Winona', 'Ryder')
    INSERT INTO @acts_in (movie_id, actor_ID) VALUES
    (1, 1),(1, 6),
    (2, 2),(2, 4),
    (3, 3),(3, 4),
    (4, 4),(4, 5),
    (5, 4),(5, 7),
    (6, 4)
    Which would have allowed us to come up with this:
    SELECT m2.director, a.first_name, a.last_name, m2.movie_Name
    FROM ((((@movies m
    INNER JOIN @acts_in ai
    ON m.movie_ID = ai.movie_ID)
    INNER JOIN @actors a
    ON ai.actor_ID = a.actor_ID)
    INNER JOIN @acts_in ai2
    ON a.actor_ID = ai2.actor_ID)
    INNER JOIN @movies m2
    ON ai2.movie_ID = m2.movie_ID)
    WHERE m.director = 'Tim Burton'
    GROUP BY m2.director, a.first_name, a.last_name, m2.movie_Name
    IIRC the primary difference between TSQL and the "Access SQL" is the freakin parens. So that *should* run in access, which you appear to be using.
    Don't forget to mark helpful posts, and answers. It helps others to find relevant posts to the same question.

  • Usage of Lexical Parameters in PL/SQL code

    Hello Everyone,
    I am trying to use a query in the pl/sql code which has 9 parameters ( Earlier this query was used in a Report i.e. report6i , so we used the lexical parameter to handle the parameters). But according to our new requirement i have to use this query with the same set of parameters in a PL/SQL code.
    To be more specific of the 9 input parameters to the report one of the parameter is order_date_from and order_date_to. the possibilities are like
    order_date_from = null and order_date_to = null
    order_date_from = not null (some value) and order_date_to = null
    order_date_from = null and order_date_to = not null (some value)
    order_date_from = not null (some value) and order_date_to =not null (some value)
    these above four possibilities are for one lexical parameter (say) like this i have six more combinations.
    Since PL/SQL doesnt support any lexical parameters do i have any other way to handle this situation ?? Any help is greatly appreciated.
    Thanks
    Tarun

    If your columns are named order_date_from and order_date_to and your corresponding parameters are named p_order_date_from and p_order_date_to then you can go with the following approach.
    WHERE order_date_from = NVL(p_order_date_from, order_date_from)
       AND order_date_to = NVL(p_order_date_to, order_date_to)Message was edited by:
    scott.swank

  • Dynamic PL/SQL code into ODI Procedure

    Hi guys:
    I have a PL/SQL code to execute into a ODI proc that changes because of a loop.
    I have to update N tables that have the same prefix and its sufix is the dynamic part of my PL/SQL. Also I have to set the DT_ETL (I already have a variable in my package with the sysdate) and the limit of a rownum.
    These are my variables:
    vGET_CD_BASE*
    vQTD_REG_UPDATE*
    vETL_DATE*
    The PL/SQL is described below (with the dynamic parts of it as ODI variables #vXXXXX):
    DECLARE
    CURSOR v_Cur IS
    SELECT ROWID KEY_ROW FROM GG_DATA.WRK_SN_DET_ITEM_EXTR_PARC_*#vGET_CD_BASE* WHERE DT_ETL = TO_DATE('01/01/1900','DD/MM/YYYY') and rownum < *#vQTD_REG_UPDATE*;
    TYPE t_Tabela IS TABLE OF ROWID INDEX BY BINARY_INTEGER;
    r_Reg t_Tabela;
    BEGIN
    OPEN v_Cur;
    LOOP
    FETCH v_Cur BULK COLLECT INTO r_Reg LIMIT 100000;
    FORALL i IN 1..r_Reg.COUNT
    UPDATE GG_DATA.WRK_SN_DET_ITEM_EXTR_PARC_*#vGET_CD_BASE*
    SET DT_ETL = TO_DATE('*#vETL_DATE*','DD/MM/YYYY HH24:MI:SS')
    WHERE ROWID = r_Reg(i);
    EXIT WHEN v_Cur%NOTFOUND;
    COMMIT;
    END LOOP;
    CLOSE v_Cur;
    COMMIT;
    END;
    What do I have to change to make this PL/SQL works in ODI Procedure?
    Regards.
    Luiz Araujo

    Luiz,
    One way you could do is by using the "Command on Source" and "Command on Target" feature of an ODI procedure:
    In Command on Source, you can write query like:
    >
    select vGET_CD_BASE, vQTD_REG_UPDATE, vETL_DATE from some_configuration_table_containing_n_rows
    >
    In Command on Target, you can write:
    >
    DECLARE
    CURSOR v_Cur IS
    SELECT ROWID KEY_ROW FROM GG_DATA.WRK_SN_DET_ITEM_EXTR_PARC_#vGET_CD_BASE WHERE DT_ETL = TO_DATE('01/01/1900','DD/MM/YYYY') and rownum < #vQTD_REG_UPDATE;
    TYPE t_Tabela IS TABLE OF ROWID INDEX BY BINARY_INTEGER;
    r_Reg t_Tabela;
    BEGIN
    OPEN v_Cur;
    LOOP
    FETCH v_Cur BULK COLLECT INTO r_Reg LIMIT 100000;
    FORALL i IN 1..r_Reg.COUNT
    UPDATE GG_DATA.WRK_SN_DET_ITEM_EXTR_PARC_#vGET_CD_BASE
    SET DT_ETL = TO_DATE('*#vETL_DATE*','DD/MM/YYYY HH24:MI:SS')
    WHERE ROWID = r_Reg(i);
    EXIT WHEN v_Cur%NOTFOUND;
    COMMIT;
    END LOOP;
    CLOSE v_Cur;
    COMMIT;
    END;
    >
    So, for "n" records that are returned by the source query, your PL/SQL package will run "n" times, each time substituting the values of vGET_CD_BASE, vQTD_REG_UPDATE, vETL_DATE respectively.

Maybe you are looking for

  • Create a new group in Messaging

    How do you create a new group in messaging, I had to select ios4.33 in the Operating system as ios5 is not available yet

  • Moving Itunes From one computer to another

    HI, Can anyone offer advice for moving Itunes from one laptop to another? The original laptop that has my itunes on it, has broke, it froze and will not operate. Rather that lose all my purchased music and playlists i would like to swap it to another

  • Saving pdf files on my mac that were originally created on a pc deletes all previous input.

    Hi, I have a Mac and a PC on my workplace. We frequently use PDF files. So to make work easier i connected them via our network so we could be more efficient. But I have a big problem. When i create .pdf files on my computer and then transfer them to

  • Any reason to scan PXI-2575 and SCXI-1127 in a particular order?

    Hello- Is there any reason to prefer one scan-list order over any other? specifically is it better to scan through ch0, ch1, ch2, etc rather than randomly? It doesnt seem like it would matter.. but many DAQ devices behave strangely if you scan them i

  • Collection of Objects for Transporting to Test Box

    Hi Experts, I am ready to transport from BW Dev system to Testing system.Actually some of the Objects activated before for diffrent applications like FI-CO,SD and CRM and exported to testing system.Now My turn to export some of the objects to test bo