Is it possible to combine dynamic & static queries in the ref cursor?

Hi all

I was wondering if it is possible to combine dynamic & static queries in the ref-cursor?
CREATE OR REPLACE FUNCTION dynamic_static_kk
   RETURN sys_refcursor
AS
   o_cursor   sys_refcursor;
BEGIN
  open 'select 1 fom dual'
       union
       select 2 from dual;

   RETURN o_cursor;
END;
In the existing code, the two parts of the query are static, but I need to improve & replacement of part would do the trick.

So, I was wondering if it is possible to keep the static part 2. Of course, do both dynamic parts seems the only possible treatment for me.

So, I was wondering if it is possible to keep the static part 2.

No, you can't.

Of course, do both dynamic parts seems the only possible treatment for me.

Yes, it's the only way.

Tags: Database

Similar Questions

  • It is possible to combine hard disks to increase the space for the C: drive?

    My c drive is running out of space. However there enough space in the hard disk in the other readers. Is it possible to combine one or two partitions c and increase the space available in c without formatting. I'm using vista Home premium

    It is possible, if you format a partition you want to combine. If you have some data, you can move them to another place or external drive. Then I say you want to combine the D and C drive (you could do it with any other drive):

    1) go to start, then right click on computer and then click on manage

    (2) then find storage-> disk management

    (3) right click on the D drive, then click on remove

    (4) then right click on C, then click on expand

    Note that in this case, as I said information on drive D will be lost. So make sure you save them. It might be a question that if you install something on drive D, you will need to reinstall it.

    Drive D example right, you have picked any other player.

  • Can change us static text to the interactive course?

    Hi Experts,

    Is it still to change static text to the interactive course?. During the execution of my lot my display is as follows,

    From.jpg

    I want to change that during the lanterns as follows,

    To.jpg

    Can this be possible to change/add static text to the interactive courses, if so please suggest me the approach to achieve this.


    Note: I want to change the static contents of the static form.

    Thank you

    Raman C.

    Hello

    Exit 12.1, the 'Interactive edition' parameter has been added to text box objects.

    When this option is enabled, you can change the text in interactive or data entry failure Studio box

  • REF cursor in sql dynamic help to run immediately

    Hello

    How can we get the Ref cursor out a dynamic sql statement by executing immediate proceedings
    for example, immediately run ' open CROR for select * from dynamicTable'

    in this area, CROR is a dynamic cursor and table name is dynamic (known at run time), and we can't write static sql statement.

    Thank you

    I don't know what exactly you are after but here is a sample of what can be done.

    SQL> VAR r REFCURSOR;
    SQL> BEGIN
      2          OPEN :r FOR 'SELECT * FROM DUAL';
      3  END;
      4  /
    
    PL/SQL procedure successfully completed.
    
    SQL> PRINT r
    
    D
    -
    X
    

    You can use the OPEN... FOR education with a dynamic string.

  • Dynamic SQL with a Ref Cursor

    Hello

    I have a package that returns a Ref Cursor, in this procedure, I have a dynamic sql code that is built according to certain values, and the query is a select query, is it possible that I can put that dynamic sql in the ref cursor and return of the procedure.

    Or y at - it no alternative better workaround.

    Thanks in advance.

    Naveen

    Yes you can.

    Try this...

    create or replace package test_pack is
    type ref_cur is ref cursor;
    procedure just_print(ref_var ref_cur);
    end;
    /
    
    create or replace package body test_pack is
    procedure just_print(ref_var ref_cur) is
    l_var emp%rowtype;
    begin
    loop
    fetch ref_var into l_var;
    exit when ref_var%notfound;
    dbms_output.put_line(l_var.ename);
    end loop;
    end;
    end;
    /
    
    declare
    cur_var test_pack.ref_cur;
    dsql varchar2(100);
    begin
    dsql := 'select * from emp where deptno=10';
    open cur_var for dsql;
    test_pack.just_print(cur_var);
    end;
    /
    CLARK
    KING
    MILLER
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:00.00
    

    Kind regards
    Prazy

  • Is it possible to use a statically defined appearance streams in a dynamically created annotation?

    Hello

    I want to create a document with cascade "popups".  Not the popup only integrated text, but an annotation that contains a stream of appearance that sets the text and images.  I am currently using widget annotations based on a push button field.

    Each page of my document has many citations referring to other pages in the document.  When a user hovers over the quote, I want a "popup" appear containing a representation of the destination.  However, as the destination itself will be quotes, I also want the "popup" to contain citations that the user can fly over, triggering another popup, etc.  In this way, a user can navigate the entire document without leaving the page, or by clicking the mouse.

    Of course, with even a small number of citations per page, pre calculation and statically define all these widgets causes a combinatorial explosion, making it slow and very large document.

    Instead, I want to statically define workflow appearance once per document, and then dynamically create annotations and affect the seemingly appropriate flow using JS when the user navigates.

    So far, I created an access point named in the dictionary of names, but I was not able to use it to dynamically set a dynamically created the appearance of a widget annotation workflow.

    Also, I called Doc.getIcon (), passing the AP named, which returns an Icon object.  However, after field.buttonSetIcon () and passing the AP named, the button does not appear the icon.

    Is it possible to use a statically defined appearance streams in a dynamically created annotation?

    Thank you

    Dave

    Using getIcon/buttonSetIcon must work, but you must make sure that the button is set up that it be set in page is not 'Label Only.

    Also, it is best to store the icons of hidden buttons and recover them with buttonGetIcon due to a bug that causes the icons at the level of the document get wiped out when performing a save as operation file.

  • Is it possible to keep all static?   (vs dynamic SQL)?

    Hi all

    I have existing MS who after db Exchange should work with newly partitioned table partition name = date of entry both inside AND date_param, something like:

    sql_string: =' select * tt partition (P_'| date_param |') the problem of configuration required, I can't use any dynamic SQL and it really put me in the corner, do you think it is at all possible? I was thinking about a lot of things that may work, but date_param is just date < 12 - 7.-10. > and partition is preceded with PRT_?

    I can to with str_part: = ('(P_'|| date_param ||'') ') "), but it is already dynamic...

    Even after I create the temporary table and for sure, I know that the DDL inside the procedure should be ONLY dynamic?
    What is the dead end? There is a way to CREATE static? or simply to use kind of temp table created outside MS and clean it before use? or...

    I actually try to see why customer site cannot manage NDS or they just don't want it, but can't argue with that for now.
    I've got enough new to Oracle and couldn't do bad things on the SQL dynamic (NDS)?

    Thank you all
    TR

    Trento wrote:
    Hi all

    I have existing MS who after db Exchange should work with newly partitioned table partition name = date of entry both inside AND date_param, something like:

    sql_string: =' select * tt partition (P_'| date_param |') the problem of configuration required, I can't use any dynamic SQL and it really put me in the corner, do you think it is at all possible? I was thinking about a lot of things that may work, but date_param is just <12-Sep-10>and partition is preceded with PRT_?

    I can to with tmp_part: = ('(PRT_'|| date_param ||'') ') "), but it is already dynamic...

    Even after I create the temporary table and for sure, I know that the DDL inside the procedure should be ONLY dynamic?
    What is the dead end? There is a way to CREATE static?

    I actually try to see why customer site cannot manage NDS or they do not want, cannot buy with that for now. I'm pretty new to Oracle and could not do bad things on dynamic SQL?

    Thank you all
    TR

    Why the hell wouldn't you just query the table and apply the predicate? Oracle would then partition elimination for you.

    No need for anything either dynamics based on what you posted.

  • How to combine multiple regex queries in a script?

    Hello

    is it possible to combine several queries regex in JavaScript? I export text from a database with custom labels and regex queries interpret the text AND character style replacements.

    example of

    Let's say my exported text is as follows

    "I have a very large text of < tag_bold > < / tag_bold > that includes a large number of styles of different characters, such as < tag_bold >"BOLD"< / tag_bold >, < tag_italic > italic < / tag_italic >, < tag_bold >"BOLD"with certain < tag_bold_underline > underlined words < / tag_bold_underline > < / tag_bold >. ,

    «to the words with different < tag_size-2 > text size < / tag_size-2 >»

    The result I want is

    "I have a very large text that includes a large number of styles of different characters, such as bold, italic,

    "BOLD", with a few words that are underlined, or never words with different text size.

    Note that all the tags open and close in the same paragraph and there's nested pairs of tags in some cases. If I run my requests (more than 20) of the outer pair the inner exception, i.e.:

    < tag_bold >... < / tag_bold >

    < tag_italic >... < / tag_italic >

    < tag_size-2 >... < / tag_size-2 >

    < tag_bold_underline >... < / tag_bold_underline >

    Thanks in advance for your help

    DPS

    If your character style name and tag name so I think it's a complete solution for you

    try code below:

    myDoc var = app.activeDocument;

    var charastyles = myDoc.characterStyles.everyItem () .name;

    for (a = 1;

    {

    repl_charastyles (charastyles [a])

    }

    function repl_charastyles (charstyle)

    {

    app.changeGrepPreferences = NothingEnum.nothing;

    app.findGrepPreferences = NothingEnum.nothing;

    app.findGrepPreferences.findWhat = '<' +="" charstyle="" +="" '="">' + '(.+?)';

    app.changeGrepPreferences.changeTo = ' $1 ';

    app.changeGrepPreferences.appliedCharacterStyle = charstyle;

    app.activeDocument.changeGrep ();

    app.changeGrepPreferences = NothingEnum.nothing;

    app.findGrepPreferences = NothingEnum.nothing;

    }

    Shonky
  • Summary of functions (two entries) for classes of brother with a dynamic distribution of entry: the static entry retains the type of the parent class.

    Suppose that in a hypothetical example, I have a superclass (number) with two children (real and complex) classes.

    I would define a function of sum for these classes, using dynamic distribution.

    Real or complex would have its own method of the sum (VI) which would be subject to various operations, such as the real and complex numbers are different.

    As I understand it, the normal way to proceed in OOP is for each of these methods to have an entry of dynamic distribution and a static entry of its own type.

    Problem: Labview doesn't let me do this!

    I first define an input method dynamic-shipping dummy for the numberof the parent class, but only the first entry can be dynamic-Envoy while the other is statically typed as number.

    Then, when I create override methods in my two children classes real and complex, the second entry (static) remains under the number (the type of the parent class). This is not fair, because then I can't access the private data of the child class of type real or complex that will be connected to the second input (static).

    What is the solution to this problem (usually)?

    I think that, in LVOOP, you use only a dynamic terminal or a static terminal to the terminal object.

    You can have several other terminals, but all the dynamics VI (methods with the same name) must have the same API (terminals).

    If you have to understand your preferred mode to pass, use multiple terminals, not used by each method, or use a cluster that contains all the numbers to pass (real or complex, both of which are not used in each method) or you can try a Variant, as shown.

  • Help with dynamic static L2L

    I'm having some trouble with a L2L tunnel where the remote end has a address DHCP on the external interface, this is a

    WRVS4400N Wireless - N Gigabit Security Router with VPN, and I am locked into a particular to this end configuration.  My end is an ASA5540, who must accept a dynamic connection, and I can do everything I need of to get this up and running...

    Remote endpoint in Rome

    192.168.252.0/24 within the network and must be able to talk to my end 192.168.240.0/24; 192.168.241.0/24; and 192.168.242.0/24

    Setting up IPSec in Rome which cannot be changed:

    IKE with preshared key

    Phase 1 3DES, MD5, DH 2, key to life 86400

    Phase2 3DES, MD5, activate the PFS, 2 DH, life 28800, pre-shared key XXXXX

    On my end, I have immunity from the ACL and NAT correct... I can actually treat the current remote outside intellectual property as static and bring the tunnel up without problem.  My problem is getting the correct dynamic Cryptography.

    Here is what I currently have (or should I say have configured previously) on the SAA in the measurement of the dynamic crypto:

    Crypto ipsec transform-set esp-SHA-ESP-3DES-3des esp-sha-hmac

    Crypto ipsec transform-set ESP-3DES-MD5-esp-3des esp-md5-hmac

    life crypto ipsec security association seconds 28800

    Crypto ipsec kilobytes of life - safety 4608000 association

    Crypto dynamic-map cisco 1 set of transformation-ESP-3DES-MD5

    Crypto dynamic-map cisco 1 lifetime of security association set seconds 28800

    kilobytes of life crypto dynamic-map cisco 1 set security-association 4608000

    crypto isakmp identity address

    crypto ISAKMP allow outside

    crypto ISAKMP policy 5

    preshared authentication

    3des encryption

    md5 hash

    Group 2

    life 86400

    Therefore my isakmp policy 5 is my stage 1 Kit.  My ESP-3DES-MD5 transformation corresponds to my need phase 2 encryption/authentication...

    I think that all I'm missing is a way to match the PFS and DH 2 for phase2?

    And since my ACL is named in Rome, then my tunnel-group must be named Rome as well?

    Thank you.

    I don't think that we can have several dynamic IP counterparts use diff pre-shared in these settings.

    -

    Sourav

  • What are the advantages and disadvantages of the two "listener: Dynamic &amp; static record.

    Hello
    What are the advantages and disadvantages of dynamic registration of the listener?
    and
    What are the advantages and disadvantages of the static recording of the listener?

    Thank you
    Uday

    Some facilities (for example, restart with the Data Guard Broker) will not work unless you appropriate defne registered staticly service. Other facilities (failover of such service) do not work unless you use a dynamically registered service.
    Decide what you want to implement and configure registration accordingly. There is no "advantages and disadvantages".

  • Possible to have dynamic content in a campaign?

    Is it possible to have dynamic in an email campaign content elements so that different content appears based on the interests of the beneficiary?

    Hey there, Nope.

    BUT

    See the BC Blog

  • Is it possible to combine and sort data in a foreach loop 2?

    Hello

    I have a rtf model in which I need to display the data in a table of the xml data file. I used 2 loops for each to show 2 portlets as xml data. Thus, there are 2 lines in the table with the first row with a foreach for portlet1 lines loop and second loop for each line retrieves lines from portlet2 to an xml file. Now I have to data table by date tro. Is it possible to combine and sort the data in those 2 loops for each?

    Thank you

    Hi Aditya,

    Received your mail, responded with the required solution

    don't use two separate loops, convert them to a single and sorting.

    Let me know how it works ;)

    It should work :)

  • 2 running, 1 inside and 1 sql external, dynamic queries using loops and ref Cursor

    Hi all

    I'm under Oracle 10.2.0.2. I'm currently building dynamic sql using external and internal queries ref Cursor. Queries make use of user selected lists of ID, which is stored in a table in memory at run time. My example is as follows. From a list of book_publication_id on a web page, the user selects several books. The same user selects then several maps from a list of map_publication_id on the same web page. A book contains several maps and some of these cards will appear in more than one book (aka many many relationships).

    This should then ask the following output to a new web page:
    Outer loop:  Display book details for book_publication_id 230
      Inner loop:  Display 1st map details for map_publication_id 340
      Inner loop:  Display 2nd map details for map_publication_id 346
      Inner loop:  Display 3rd map details for map_publication_id 350
    Outer loop:  Display book details for book_publication_id 240
      Inner loop:  Display 1st map details for map_publication_id 346
      Inner loop:  Display 2nd map details for map_publication_id 375
    Outer loop:  Display book details for id 255
    and so on.
    In the example above, the outer loop displays the details of the book for book_publication_id 230 and the inner loop displays all the users selected the maps in book_publication_id 230. Then, it moves on the details of the book for book_publication_id 240 and done the same thing again. Similar in some ways to how break would work in SQL * Plus, even if the table is built like an HTML, the book details must be on a separate line for the card details. However I don't know how I would want it to work.

    So far, using loops, I could not show all the details of card for each different book_publication_id, after the details of the book for only 1 book_publication_id are displayed each time. If a loop in a loop. I hope that makes sense. I think this is my internal request that it be built differently. My code for this part of the program, which is currently wrong, is as follows:
    --Global variable section contains:
    var_user_chosen_map_list_ids VARCHAR2(32767);
    var_details VARCHAR2(32767);
    ......
    PROCEDURE PROCMAPSEARCH (par_user_chosen_map_list_ids PKG_ARR_MAPS.ARR_MAP_LIST)
    IS
    BEGIN
    FOR rec_user_chosen_map_list_ids IN 1 .. par_user_chosen_map_list_ids.count
    LOOP
       var_user_chosen_map_list_ids := var_user_chosen_map_list_ids || 
       '''' || 
       par_user_chosen_map_list_ids(rec_user_chosen_map_list_ids) || 
       ''',' ;
    END LOOP;
     var_user_chosen_map_list_ids := substr(var_user_chosen_map_list_ids,
                                            1, 
                                            length(var_user_chosen_map_list_ids)-1);
    var_details := FUNCMAPDATAFIND (var_user_chosen_map_list_ids);
    htp.print(var_details);
    END PROCMAPSEARCH;
    FUNCTION FUNCMAPDETAILS (par_user_chosen_map_list_ids IN VARCHAR2(32767)
    RETURN VARCHAR2
    AS
    TYPE cur_type_map IS REF CURSOR;
    cur_book_search cur_type_map;
    var_book_date NUMBER(4);
    var_book_title VARCHAR2(32767);
    cur_map_search cur_type_map;
    var_map_date NUMBER(4);
    var_map_title VARCHAR2(32767);
    begin:
    OPEN cur_book_search FOR
    'SELECT BI.book_date,
            BT.book_title
     FROM   BOOK_INFO BI,
            BOOK_TITLE BT,
            TABLE (sys.dbms_debug_vc2coll(' || par_user_chosen_book_list_ids || ')) BL_1
     WHERE BI.book_title_id = BT.book_title_id
     AND BI.book_publication_id = BL_1.column_value';
    OPEN cur_map_search FOR
    'SELECT MI.map_date,
           MT.map_title
    FROM map_info MI,
         map_title MT,
         TABLE (sys.dbms_debug_vc2coll(' || par_user_chosen_book_list_ids || ')) BL_2
         TABLE (sys.dbms_debug_vc2coll(' || par_user_chosen_map_list_ids || ')) ML
    WHERE MI.map_title_id = MT.map_title_id
    AND BI.book_publication_id = BL_2.column_value
    AND BI.book_publication_id = MI.pub_publication_id
    AND MI.map_publication_id = ML.column_value';
    LOOP
    LOOP
    FETCH cur_map_compare INTO
    var_book_date,
    var_book_title;
    var_details
    var_details := var_details || 'Book date: '||
                        var_book_date ||
                        'Book title: ' ||
                        var_book_title;
    FETCH cur_map_compare INTO
    var_map_date,
    var_map_title;
    var_details := var_details || 'Map date: '||
                        var_map_date ||
                        'Map title: ' ||
                        var_map_title
    EXIT WHEN cur_book_compare%NOTFOUND;
    END LOOP;
    EXIT WHEN cur_map_compare%NOTFOUND;
    END LOOP;
    RETURN var_details;
    END FUNCMAPDETAILS;
    If anyone has any ideas or suggestions, I would be grateful. It is an extension of my previous code, I posted a question recently. As I am working and learning a step at a time, I left this idea in my previous question, that I had to make sure I knew that first.

    Kind regards

    Tim

    Using dynamic SQL

    declare
      dd sys_refcursor;
      ee sys_refcursor;
      d dept%rowtype ;
      e emp%rowtype ;
    begin
    open dd for 'select * from dept' ;
    loop
    fetch dd into d ;
    exit when dd%notfound ;
    dbms_output.put_line('Department:'||d.dname);
      open ee for 'select * from emp where deptno='||d.deptno ;
      loop
      fetch ee into e ;
      exit when ee%notfound ;
      dbms_output.put_line('..Employee:'||e.empno||':'||e.ename);
      end loop;
    end loop ;
    end ;
    /
    Department:ACCOUNTING
    ..Employee:7782:CLARK
    ..Employee:7839:KING
    ..Employee:7934:MILLER
    Department:RESEARCH
    ..Employee:7369:SMITH
    ..Employee:7566:JONES
    ..Employee:7788:SCOTT
    ..Employee:7876:ADAMS
    ..Employee:7902:FORD
    Department:SALES
    ..Employee:7499:ALLEN
    ..Employee:7521:WARD
    ..Employee:7654:MARTIN
    ..Employee:7698:BLAKE
    ..Employee:7844:TURNER
    ..Employee:7900:JAMES
    Department:OPERATIONS
    
    PL/SQL procedure successfully completed.
    

    HTH

    SS

  • Is it possible to combine smart objects related with layers?

    I create in my compositions of another linked smart object layer. Now, I want to show them in my psd file main, as different States (showing the different States of the header of a Web site).  Always when I try to change the status of the dynamic object bound to the title of the Properties window, there is always change for all layers.

    Why I want to do? I want to use the smart object bound to different files.

    But duplicates of the CG with the corresponding layers applied can be used (shown and hidden) in the layers of the container document.

Maybe you are looking for