How to run an EXECUTE IMMEDIATE statement in an interactive report

Hi all!!

I need to make a dynamic construction of a query to run in an interactive report, but the Source of the region only allows SELECT simple instructions. There is no way to run an EXECUTE IMMEDIATE statement in a Source of interactive report region?

Cordially Pedro.

Hi Pedro,

Reduce the size of the varchar2 32000 1000 (or, up to a maximum of 4000)

Andy

Tags: Database

Similar Questions

  • Pass Pl/sql table in the USING clause in the EXECUTE IMMEDIATE statement

    Getting error when I try to pass the PL/SQL table in the USING clause in the EXECUTE IMMEDIATE statement:

    Declare
    result NUMBER;
    TYPE values_tab IS TABLE OF NUMBER INDEX OF directory;
    lv_tab values_tab;
    lv_exp varchar2 (300);
    lv_exec varchar2 (300);
    BEGIN
    lv_tab (1): = 5;
    lv_tab (2): = 48;
    lv_tab (3): = 7;
    lv_tab (4): = 6;
    lv_exp: = ': + b1: b2 + (: b3 *: b4)';
    lv_exec: = 'SELECT'. lv_exp | ' THE DOUBLE '.

    IMMEDIATE EXECUTION
    lv_exec
    IN
    result
    USING
    lv_tab;
    DBMS_OUTPUT. Put_line (result);

    END;
    /

    Error on line 1
    ORA-06550: line 20, column 12:
    PLS-00457: expressions must be SQL types
    ORA-06550: line 15, column 8:
    PL/SQL: Statement ignored


    I am trying to evaluate the expression ': + b1: b2 + (: b3 *: b4) "which is stored in the table. This table has different expressions (expressions about 300). I want to use the bind variable in the expression because each expression evaluated thousands of time may be more in some cases. If I use bind variable can he fill pool.

    Is there a way I can pass parameters with the HELP of (IN) dynamically instead of write "help lv_tab (1), lv_tab (2), lv_tab (3), lv_tab (4)? As number of change of the input parameters depend on the expression in the table.

    If it is possible please suggest any other ideas/approaches

    Help, please...

    Published by: satnam on June 11, 2009 11:50

    Well, you keep changing faster reqs that I can follow. In any case, assuming that N-th variable bind (left to right) corresponds to n-th collection item:

    Declare
        result NUMBER;
        lv_tab values_tab := values_tab();
        lv_exp varchar2(300);
        lv_exec varchar2(300);
        lv_i number := 0;
    BEGIN
        lv_tab.extend(4);
        lv_tab(1) := 5;
        lv_tab(2) := 48;
        lv_tab(3) := 7;
        lv_tab(4) := 6;
        lv_exp := ':5000135+:5403456+(:5900111*:5200456)';
        lv_exec := lv_exp;
        While regexp_like(lv_exec,':\d+') loop
          lv_i := lv_i + 1;
          lv_exec := REGEXP_REPLACE(lv_exec,':\d+',':b(' || lv_i || ')',1,1);
        end loop;
        lv_exec := 'BEGIN :a := ' || lv_exec || '; END;';
    DBMS_OUTPUT.PUT_LINE(lv_exec);
    EXECUTE IMMEDIATE lv_exec USING OUT result,IN lv_tab;
    DBMS_OUTPUT.PUT_LINE(result);
    END;
    /
    BEGIN :a := :b(1)+:b(2)+(:b(3)*:b(4)); END;
    95
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    

    SY.

  • The concatenation of the EXECUTE IMMEDIATE statement.

    Hi all

    The situation is that I am trying to find all customers whose Date of birth (DOB) is greater than or equal to 150 days. Unfortunately, when I run this SQL I get the error message:
    (1) ORA-00904: "FEB": invalid identifier
    (1) ORA-06512: at line 4 level

    I'm not sure what I should do to solve this problem, I hope you can help.

    Note: I have to encapsulate this statement in an immediate execution due to problems of roles/Privilidge. In the full version, I also use AUTHID CURRENT_USER.


    DECLARE
        curr_date Date := SYSDATE;
    BEGIN
        EXECUTE IMMEDIATE ' SELECT  cust_name,
                                    cust_dob, -- date of birth
                                    cust_shoe_size
                            FROM    tblCustDetails c
                            WHERE   SUBSTR(c.cust_name, 1,7) = ''Bob''
                                    AND cust_dob >= NEXT_DAY(' || curr_date ||' - 150 , ''SATURDAY'')
                             ';
    END;
    Edited by: DaveyB February 23, 2012 08:39

    The right way to use dynamic queries like this would get stuck in the variables you use... for example

    DECLARE
        curr_date Date := SYSDATE;
    BEGIN
        EXECUTE IMMEDIATE ' SELECT  cust_name,
                                    cust_dob, -- date of birth
                                    cust_shoe_size
                            FROM    tblCustDetails c
                            WHERE   SUBSTR(c.cust_name, 1,7) = ''Bob''
                                    AND cust_dob >= NEXT_DAY(:1 - 150 , ''SATURDAY'')
                             ' USING curr_date;
    END;
    

    However, you also have to take into account the fact that the results of the query are currently disappearing into the ether, so you need an INTO statement...

    DECLARE
        curr_date Date := SYSDATE;
    BEGIN
        EXECUTE IMMEDIATE ' SELECT  cust_name,
                                    cust_dob, -- date of birth
                                    cust_shoe_size
                            FROM    tblCustDetails c
                            WHERE   SUBSTR(c.cust_name, 1,7) = ''Bob''
                                    AND cust_dob >= NEXT_DAY(:1 - 150 , ''SATURDAY'')
                             ' INTO var1, var2, var3 USING curr_date;
    END;
    

    ensure that your variables are declared as appropriate, and then...

    ... you have to take into account the possibility that there is more than 1 line returned, in which case you will have the results of the query to a collection.

    Of course, it is useless for dynamic SQL statements in the first place...

    DECLARE
        curr_date Date := SYSDATE;
    BEGIN
      SELECT  cust_name,
              cust_dob, -- date of birth
              cust_shoe_size
      INTO    var1, var2, var3
      FROM    tblCustDetails c
      WHERE   SUBSTR(c.cust_name, 1,7) = 'Bob'
      AND     cust_dob >= NEXT_DAY(curr_date - 150 , 'SATURDAY');
    END;
    

    still, you should always take into account the bulk collection in a collection if it were going to be more than one row returned.

  • suffixing date in the EXECUTE IMMEDIATE statement

    Hi could one please let me know how I can the suffix of the name of the table to the year, which the calculation is being in the select statement. Output should be as an example: test_2007
    declare
    
    abc number;
    
    begin
    
       select (to_char(sysdate, 'YYYY') - 4) into abc from dual;
    
       EXECUTE IMMEDIATE 'CREATE TABLE test_&abc as select * from emp where 1=2';
    
    end;

    You can do it like this

    BEGIN
       EXECUTE IMMEDIATE
             'CREATE TABLE test_'
          || (TO_CHAR ( SYSDATE, 'YYYY') - 4)
          || ' as select * from emp where 1=2';
    END;
    

    You can use your variable as well, if this can change dynamically.

    DECLARE
       abc            NUMBER;
    BEGIN
       SELECT (TO_CHAR ( SYSDATE, 'YYYY') - 4) INTO abc FROM DUAL;
    
       EXECUTE IMMEDIATE 'CREATE TABLE test_'||abc||' as select * from emp where 1=2';
    END;
    

    Edited by: g. March 1, 2011 11:49

  • Error in EXECUTING IMMEDIATE statement

    Hello again, friends, I have this block:
    SET SERVEROUTPUT ON
    DECLARE
    columnCount pls_integer;
    counter pls_integer := 1;
    columnName VARCHAR2(50);
    sqlQuery VARCHAR2(1000);
    columnLength pls_integer;
    dataType VARCHAR2(50);
    rowSize pls_integer;
    BEGIN
      rowSize := 0;
      SELECT COUNT(TABLE_NAME) INTO columnCount FROM USER_TAB_COLUMNS WHERE TABLE_NAME = 'PERSON';
      WHILE counter <= columnCount LOOP
        SELECT COLUMN_NAME, DATA_TYPE INTO columnName, dataType FROM USER_TAB_COLUMNS WHERE TABLE_NAME = 'PERSON' AND COLUMN_ID = counter;
        IF dataType = 'BLOB' THEN
          sqlQuery := q'[SELECT NVL(DBMS_LOB.GETLENGTH(]' || columnName || q'[), 0) FROM PERSON WHERE UUID = '999E5241-02AD-45fc-958A-CE808B0F56A6']';
        ELSIF dataType = 'SDO_GEOMETRY' THEN
          sqlQuery := q'[SELECT 500 FROM DUAL]';
        ELSE
          sqlQuery := q'[SELECT NVL(DBMS_LOB.GETLENGTH(CAST(]' || columnName || q'[ AS VARCHAR2(4000))), 0) FROM PERSON WHERE UUID = '999E5241-02AD-45fc-958A-CE808B0F56A6';]';
        END IF;
        EXECUTE IMMEDIATE sqlQuery INTO columnLength; -- Error here
        rowSize := rowSize + columnLength;
        counter := counter + 1;
      END LOOP;
      DBMS_OUTPUT.PUT_LINE(rowSize);
    END;
    It shows me:

    DECLARE
    *
    ERROR on line 1:
    ORA-00911: invalid character
    ORA-06512: at line 21

    What could be?

    Get rid of semi-colons in:

    sqlQuery: = q'[SELECT NVL (DBMS_LOB. [(GETLENGTH (CAST (]' | columnName | q'[AS VARCHAR2 (4000)])), 0) OF THE PERSON WHERE the UUID = '999E5241-02AD-45-CF - 958 A-CE808B0F56A6';]';

    Must be:

    sqlQuery: = q'[SELECT NVL (DBMS_LOB. [(GETLENGTH (CAST (]' | columnName | q'[AS VARCHAR2 (4000)])), 0) OF THE PERSON WHERE the UUID = "999E5241-02AD-45-CF - 958 A-CE808B0F56A6"] ";

    SY.

  • How to get .oce to talk to DAS &amp; bring interactive reporting data?

    Hi Hyperion Experts,

    It is also a pretty basic question, I use Hyperion 9.3.1 and I Shared Services, workspace and interactive Studio reports running on our Windows Server 2003.

    My goal is to import a .bqy document that I created in Studio of Interactive Reporting in the workspace and be able to click on the button "Refresh" and see that it refreshes the data in the back-end Oracle 10 g database.

    I completed the following steps so far,

    1. I created a DSN. This DSN named 'Oracle 10 g Data Source', when I clicked on the button "Test connection", he was properly executed.

    2. I created a new entry of the data source in the DAS service. If I double click on the newly created data source entry, the screen displays the following details.

    Type of connectivity = Oracle Net
    Database of Type = Oracle
    Enter the name of the data source = Oracle 10 g Data Source
    Select the name of the data source (it is grayed out, nothing is selected)
    Server/folder (it is grayed, nothing entered)
    then, followed by a few default connection settings.

    3. I created a file of "Oracle 10" g Data Source.oce using the Studio Interactive Reporting. I saved the .oce file in
    C:\Hyperion\BIPlus\data\Open catalog Extensions\Oracle 10 g Data Source.oce

    4. I created a new constrProj_Oracle10gOCE.bqy when creating, I chose
    "Create a new document with the recent database connection file" option, so I chose the Oracle 10 g Data Source.oce I created in step 3. After that I connect with host username/password, I created a data model and I see that he brings a set of data when I clicked on the "process" button I saved this document .bqy.

    5.
    I imported the Oracle 10 g Data Source.oce and constrProj_Oracle10gOCE.bqy in the workspace under a folder called
    MYBI/test/root

    6. I right click on the constrProj_Oracle10gOCE.bqy document and chose "open." He opened with the results section highlighted on the left side and data showing on the right. However, when I clicked the "Refresh" button, I get a message box with a red X. It is said:

    A Reporting Service interactive error -.
    Unable to acquire the requested service.
    (2001)

    I suppose that the data I see in this constrProj_Oracle10gOCE.bqy was just the cached data that has been brought to the time where I hit the button to deal with this .bqy when it was first created in the Studio, and that he has never established any connection through the DAS service for the backend.

    Could someone please show me what I've done wrong here?

    Thank you

    hypuser1010

    You can change the TNS entry for the source of ODBC data on the server without ill effect is because it's redundant in your situation :-) You never didn't it because you did not in place of the ECO to use an ODBC data source in the first place.

    do not forget that the DAS data sources are not the same as ODBC data sources. You only need an ODBC data source on your server if your OCÉ uses one. In any case, the DAS data source name should always match the text entered in the field host name to ECO.

    Glad to hear the bqy document now refreshes needed.

  • How to create a column width fixed in an interactive report 4 APEX?

    This thread is a continuation of {message identifier: = 9191195}. Thank you fac586.

    Partial success: the following code provided by fac586 limit the width of the column of the Apex 4 interactive report as long as the data in the column contains a white space in a browser Firefox 3.6:

    < pre class = "jive-pre" >
    < style type = "text/css" >
    e #T_DESCRIPTION {}
    Width: 300px;
    }
    TD [headers = "T_DESCRIPTION"] {}
    Width: 300px;
    dressing: break-Word;
    }
    < / style >
    < / pre >

    Notes:
    1. the above code is placed in the HTML header for the page section.
    2 T_DESCRIPTION is defined as VARCHAR2 (2000).
    3. the above code works in Firefox 3.6.12 browser but does not work in the browser Internet Explorer 7.0.5730.13.

    I tried to add "float: left;":

    < pre class = "jive-pre" >
    < style type = "text/css" >
    e #T_DESCRIPTION {}
    Width: 300px;
    }
    TD [headers = "T_DESCRIPTION"] {}
    Width: 300px;
    dressing: break-Word;
    < font color = "red" > float: left; < / police >
    }
    < / style >
    < / pre >

    Notes:
    1 "float: left;" requires no white space and successfully splits the column between the characters instead of whitespace.
    2. "float: left;" reduces the height of the cell and allows the page to show through... could not determine how to solve this fundamental problem.
    3. the above code works in Firefox 3.6.12 browser but does not work in the browser Internet Explorer 7.0.5730.13.

    I've did some more research, but I've yet to discover how to create a fixed-width column in an interactive APEX 4 report that displays correctly in Internet Explorer 7 browser.

    Ideas and help will be appreciated.
    what theme are you using?

    A customized version of the 15 theme.

    You said you were using APEX 4.0, if I was testing on 4.0, but using one of its new themes based on the standards. 15 theme is a theme of legacy from older versions of APEX, mainly to ensure a certain level of support for the despised IE6 browser. The new themes are designed to restore mode standard and those inherited mode quirks (This is explained here). Firefox (and Safari, Opera and Chrome, and...) for your application, it's academic: all the required CSS: selectors attribute, the property max-width and dressing work in two modes.

    Enter Microsoft. They decided that in IE7, backwards compatibility meant that new CSS features would be supported only in standard mode, even if they had never been implemented in older versions, with no previous, behavior that may break. Go figure. Yes, even so the dressing will work in quirks mode (no surprise - Microsoft invented), attribute selectors, and max-width only. The latter is bug in standard mode, so I tried using widthworkaround, but who has always used an attribute selector, which of course is ignored, there are no selectors of friendly quirks mode in uneditable Oracle IR of supplement.

    The best 2 options are:

    1. stop using IE.

    2. use a theme based on standards.

    Less satisfactory would be:

    3. change your theme custom (or some of its pages) in standard mode (but it could break him other stuff).

    4 throw some JavaScript to fix the problem (I'll sleep on this one).

  • How to change the width of columns in an interactive report?

    I have an interactive report. I want to customize the width of the column in the report. How to get there?

    Thank you
    Jen

    Two things... (1)

     items are for the forum display use only, do NOT copy them to your page in APEX..  2) I have modified your page 23 in your app, I have added the code in the proper location and removed the other code you had in place and copied it to the comments section of page.
    
    Please take a look and adjust the size accordingly..
    
    If this answers your question, please mark the question as answered and assign points where due..
    
    Thank you,
    
    Tony Miller
    Webster, TX
    
    Time flies like the wind, but fruit flies like bananas.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
    
  • How can I delete a filter automatically on an interactive report when I get back

    I have several pages with interactive reports. If the user implements the filters to refine the list in the report, they are still there the user returns to that page later, even if I clear the cache.

    How can I make the interactive report raise the base with no additional filter report when the user returns to the page?

    Thank you

    The doc of the APEX to the http://download.oracle.com/docs/cd/E14373_01/appdev.32/e11838/app_comp.htm#sthref989

    >
    To restore an interactive report in a link, use the string "RIR" in the section Cache Clear of a URL. This means the user choose the Reset option in the menu interactive report actions on the target page. The report is returned to the default report parameters specified by the developer.
    >

    CITY

  • How can I access the filthers used in the interactive reports?

    Greetings,

    I develop several applications for APEX.
    Right now I make use of interactive reports.
    They are excellent tools, simple querys can do a lot if they use an interactive report.

    How you can that yend users can perform a filthers on the road is one of the best features that they have, from my point of view.
    It's so good that I was wondering if it is possible to use the filthers activated by an end user.

    Example, this query is in an interactive report: SELECT name, action, year of aux_table;

    If the user sees every line of it, but being in an interactive report, the user can add a filther in column of the year, for example, and display only the lines of the year 2008.
    It is very well... And here the question arises...

    Suppose I want to do a query based on the filthers currently, the user has activated, is this possible?
    I have a created delete action that will delete all the files, BUT I want to apply the filthers to the end user than delete action, the action would be:

    DELETE FROM aux_table where year = 2008

    Is it possible to make querys that take advantage of the filthers defined by the user for interactive reports?

    Thank you

    NP - take a look on Re: interactive report - save the output and links there, they can help guide you

    Andy

  • How it is possible to create the chekbox in interactive report column header and select all the features.

    Hello

    My requirement is

    Interactive report the first element of box check columns and the topic also point check box.

    If I click on the element of box section columns and then automatically select all the lines in the box.

    Select all / deselect all interactive report header check box.

    Kind regards

    Arianne.

    Check this box

    https://Apex.Oracle.com/pls/Apex/f?p=76604:2:111027941779152:

    username:-test

    password:-test

    SELECT

    APEX_ITEM. HIDDEN (2, null, null, 'f02_': rownum) |

    APEX_ITEM. CHECKBOX2 (P_IDX-ONLINE 01,

    P_VALUE-online null,

    P_ATTRIBUTES-online null,

    P_CHECKED_VALUES => NULL,

    P_CHECKED_VALUES_DELIMITER => ':',

    P_ITEM_ID-online 'f01_ ' | ROWNUM,

    P_ITEM_LABEL => ' label for f01_ #ROWNUM # ')

    as Delete1,.

    of the double

    Choose the column type: report

    in the heading of column delete1

    Simply put

  • "EXECUTE IMMEDIATE" of CLOB

    I have plsql-variable with CLOB datatype. It contains the source code of a package body. The size of the variable does not fit into 'varchar2' data type, it is larger.
    Now, I want to run a "EXECUTE IMMEDIATE" statement to create my package body defined in my CLOB variable.
    How can I use the "EXECUTE IMMEDIATE"?
    Note that "EXECUTE IMMEDIATE" does not allow for CLOB-variable as an argument.
    Note that "EXECUTE IMMEDIATE" allows "varchar2" - variables as arguments but "varchar2" contains maximum only some 32 KB of data.


    --

    Maybe it's possible to run something like
    "EXECUTE IMMEDIATE v1 | v2 | v3»
    where v1, v2, v3 are of type varchar2 and altogether they contain ca 100K of data and execute immediately would succeed?
    I wil outside, a s test...

    I wil outside, a s test...

    You may have searched for as well ;)

    Re: immediate execution of a CLOB field.

    Note: In 11 GR 2 run immediately accepts a clob as well...

  • How can question I run an executable file in the background?

    Hello

    I'm trying to run an executable in the context of LabVIEw, but none of the methods described in the forum and on ni.com seems to work. I use LV 2011 on a 64-bit Windows 7 machine where it is important.

    I tried the method described in "How to make an executable in the background as a marketing app?" (http://digital.ni.com/public.nsf/websearch/4A8B626B55B96C248625796000569FA9?opendocument&Submitted&&... but I always see a fragment of a window at the bottom near the start (Exhibit 1) key.) Table 2 shows that it consists only of the title bar. (I customized the appearance of the window as described and added the two points

    HideRootWindow = True

    UseTaskBar = FALSE

    in the *.ini file.)

    I also tried to disable all other items in the menu customize appearance of window with the same result.

    Then I tried the method described in "Ongoing execution of an executable of LabVIEW as a background process" (http://digital.ni.com/public.nsf/allkb/EFEAE56A94A007D586256EF3006E258B) addition of the FP. Open the VI method and affecting the hidden state. I got the same result (table 1).

    Should I do more or different for my version of windows? I appreciate your help. Thank you.

    I found the problem. It was a wrong directory for the build name. I continued under an older version of the executable with the default window settings. The method that is described in how to run an executable file in the background as a startup Application? "(Works... http://digital.ni.com/public.nsf/websearch/4A8B626B55B96C248625796000569FA9?opendocument&Submitted&& .

    Sorry, for wasting your time. Mea culpa.

    Peter

  • Execute Immediate for an IF statement

    All,
    I'm trying to run an IF statement dynamically at execution using the Execute Immediate statement, but I am gettign error... The error is PLS-00201: identifier 'V_BARG_UNIT' must be declared
    The condition and the result for the case statement is stored in a test_dynamic_if_tbl table that has 2 columns.
    condition = v_barg_unit = 'ABC' and result_val = v_bg_group: = "93"

    Yet the code...

    DECLARE
    cmd VARCHAR2 (4000);
    v_barg_unit VARCHAR2 (10): = 'ABC ';
    v_bg_group VARCHAR2 (10): = ' ';

    ABC of the CURSOR
    IS
    SELECT * FROM test_dynamic_if_tbl;
    BEGIN
    FOR c1 IN abc
    LOOP
    cmd: =.
    "Start."
    If ' | C1.condition
    || "THEN."
    || C1.result_val
    || ' ; End if;
    End;';
    Dbms_output.put_line ('cmd: ' | cmd);

    Cmd EXECUTE IMMEDIATE.

    Dbms_output.put_line (' status: ' | c1.condition);
    Dbms_output.put_line ('result_value: ' | c1.result_val);
    Dbms_output.put_line ('v_bg_group: ' | v_bg_group);
    END LOOP;
    END;

    What I am doing wrong?

    Thanks for your help in advance,
    Vinay

    Published by: user652279 on September 16, 2009 11:45

    Published by: user652279 on September 16, 2009 11:47

    Well, dynamic sql is executed in a separate context and scope. V_barg_unit stated in your code is therefore not visible in the dynamic PL/SQL block you run. You can pass block dynamic PL/SQL using the variable binding and the USING clause:

    DECLARE
        cmd VARCHAR2 (4000);
        v_barg_unit VARCHAR2 (10) := 'ABC';
        v_bg_group VARCHAR2 (10) := ' ';
    
    CURSOR abc
    IS
    SELECT * FROM test_dynamic_if_tbl;
    BEGIN
    FOR c1 IN abc
    LOOP
    cmd :=
    'declare v_barg_unit VARCHAR2 (10);
    Begin
    v_barg_unit := :v_barg_unit;
    If ' || c1.condition
    || ' THEN '
    || c1.result_val
    || ' ; End if;
    End;';
    DBMS_OUTPUT.put_line ('cmd: ' || cmd);
    
    EXECUTE IMMEDIATE cmd USING v_barg_unit,OUT v_bg_group;
    
    DBMS_OUTPUT.put_line ('Condition: ' || c1.condition);
    DBMS_OUTPUT.put_line ('result_value: ' || c1.result_val);
    DBMS_OUTPUT.put_line ('v_bg_group: ' || v_bg_group);
    END LOOP;
    END;
    

    However, since you do not know what name will be stored in test_dynamic_if_tbl my suggestion is not a generic solution.

    SY.

    Published by: Solomon Yakobson September 16, 2009 12:07

  • Maximum size of EXECUTE IMMEDIATE

    Hellou everyone,

    I would like to ask if there is a way how to run the dynamic SQL CREATE or VIEW of REPLACE command more than 32 KB of wholesale. Because the EXECUTE IMMEDIATE statement can run up to 32 k (greater length of variable plsql chain) chain

    Is there a way how children Ridge or replace the command?

    Or I need to revrite using DBMS_SQL.

    Thank you.

    (a) WHY? If you want to dynamically create views?  This is not recommended because your application/database should be designed at the time of the design, not running.

    (b) If you are on 11 g, you can use the CLOB datatype with immediate execution, so there is no 32 K limit.

    (c) If you are before 11 g you need to update, but if you can't then the following example is how you do it using DBMS_SQL.

    SQL > declare

    2 v_large_sql clob.

    3 v_num number: = 0;

    number of v_upperbound 4;

    5 v_sql dbms_sql.varchar2s;

    6 whole v_cur;

    number of v_ret 7;

    8 v_join_sql varchar2 (100): = ' crΘer view vw_tmp as ";

    9 start

    10. build a very big SQL statement in the CLOB

    11 loop

    12 v_large_sql: = v_large_sql | v_join_sql | "select" the number of this line is: ' | TO_CHAR (v_num, 'fm0999999') | " "as col1 from dual;"

    13 v_join_sql: = "union all";

    14 v_num: = v_num + 1;

    15 exit when dbms_lob.getlength (v_large_sql) > 40000 or v_num > 800;

    16 end loop;

    17 dbms_output.put_line (' length :'||) DBMS_LOB. GetLength (v_large_sql));

    18 dbms_output.put_line ('Num :'|| v_num);

    19-

    20. now divide this big SQL statement into pieces of 256 characters and put in table VARCHAR2S

    21 v_upperbound: = ceil ((v_large_sql) dbms_lob.getlength / 256);

    22 because me at 1.v_upperbound

    23 loop

    24 v_sql (i): = dbms_lob.substr (v_large_sql

    25, 256 - amount

    26, ((i-1) * 256) + 1 - offset

    27                                 );

    28 end of loop;

    29-

    30. now analyze and execute the SQL statement

    31 v_cur: = dbms_sql.open_cursor;

    32 dbms_sql.parse (v_cur, v_sql, 1, v_upperbound, dbms_sql.native, false);

    33 v_ret: = dbms_sql.execute (v_cur);

    34 dbms_output.put_line ("' view created");

    35 dbms_sql.close_cursor (v_cur);

    36 end;

    37.

    Length: 40015

    NUM:548

    View created

    PL/SQL procedure successfully completed.

    SQL > select count (*) in the vw_tmp;

    COUNT (*)

    ----------

    548

    SQL > select * from vw_tmp where rownum<=>

    COL1

    -----------------------------------

    The number of this line is: 0000000

    The number of this line is: 0000001

    The number of this line is: 0000002

    The number of this line is: 0000003

    The number of this line is: 0000004

    The number of this line is: 0000005

    The number of this line is: 0000006

    The number of this line is: 0000007

    The number of this line is: 0000008

    The number of this line is: 0000009

    10 selected lines.

    SQL >

Maybe you are looking for