Using the cursor to another (nested cursors) cursor objects...?

Now, I'm pretty sure that's not possible, but as a last thought of the station, it would not hurt to ask.

I have a number of fairly complex cursors in PL/SQL (all beautifully packaged upwards), which are used in a number of other different queries for reporting. Because the same cursor is reused several times in different contexts, I want set the cursor once, then use it as a subquery in the other queries. This will also help as if I place the SQL directly in other queries, then it will be necessary propagate the changes to the base query in all other queries which use - and that it will be maintained by a large team that goes forward, it would be wide open to things being missed... (not that I don't trust my colleagues or anything like that...!)

So, in brief and simple terms, if I;

CURSOR curDateList (pi_start_date AS, pi_end_date IN DATE)
IS
SELECT pi_start_date + rownum - 1 when
FROM (select '1' sys.dual connects by level < = (pi_end_date - pi_start_date + 1));

that returns a list of the dates of pi_start_date to pi_end_date, and I want to integrate in another slider like;

CURSOR curEmpWork (pi_start_date AS, pi_end_date IN DATE)
IS
SELECT e.employee_id, dl.when, e.work_pattern
OF e xxx.emp_work_patterns,.
DL curDateList (pi_start_date, pi_end_date)
WHERE dl.when = e.roster_date
ORDER BY e.roster_date;

(Needless to say that queries are much more complex and many!)

I reached the required result by using the pipeline table functions that just open the first cursor and run each line, but am frequently end up using multiple nested functions to achieve and I see marked in this way, then the performance degradation that comes to nest queries within the other runs a lot faster. As a nested query is just a nested cursor, it seems that this is possible, but I'm not only have no chance - I am struggling to find something that says that it of possible or not (which made me think I am barking the wrong tree here!)

Any help would be greatly appreciated.

No, it is not possible, but have you thought of creating a view instead?

Tags: Database

Similar Questions

  • Why we use the cursor

    Hi all

    I would be grateful someone right me if I'm wrong. I ask the question below just for my purpose of learning.

    Question - Why do we use the cursor?

    Response Cursor is used to treat several lines in PL/SQL.

    Or

    Is used to treat a set of records from one or more tables, you can write a cursor on the table using select statement and then you can browse through all these a Recordset, and perform your required operations.

    Post edited by: Muzz, I'll open another discussion to my other question. Thank you

    Hello

    Muzz says:

    Hi all

    I would be grateful someone right me if I'm wrong. I ask the question below just for my purpose of learning.

    Question - When we use Procedure and Function when?

    Response

    When you want to run a series of DML statements then do like us and when we want to return a single value, then we use the function.

    Much has been written on this subject.  Start by finding some of them:

    https://www.Google.com/#q=when+use+procedure+function+Oracle

    read some of them and then ask a more specific question

    Procedures are not just for the DML; There are a lot of things in addition to DML you can do in the procedures.  For example, you can send e-mail messages, or can read and write files.

    The second half of your response, 'when we want to return a single value, then we use the function', is the right of bascally.  In particular, when you want to return a value that will be used in a SQL statement, you use a function.

    Functions in the pipeline are a special case.  A lot of what you read or you say about 'functions' means implicitly 'no Pipeline functions.

    Question - Why do we use the cursor?

    Response Cursor is used to treat several lines in PL/SQL.

    Or

    Is used to treat a set of records from one or more tables, you can write a cursor on the table using select statement and then you can browse through all these a Recordset, and perform your required operations.

    You'll have best results if you start a separate thread for each separate issue.  This issue is completely separate from the question on procedures

    You're right that the sliders are a way to process the rowsets, which can contain 1 line or several lines.

    Yes, you can use a slider to manage the rows one at a time.  Do not forget that it will be less effective than the manipulation of all at once, so don't use a cursor to do something that can be done in a single SQL statement.

  • When to use the cursor for loop and the cursor (open, fetch, close)

    Hello world
    I have a small doubt about when to use the cursor for loop and when to use the cursor for loop and the cursor (open, fetch, close).
    Well, I'm not the difference between implicit and explicit cursor. So please tell me how I got to know, what to use and when?




    Kind regards
    BS2012

    Published by: BS2012 on January 29, 2013 12:15

    All SQLs are analyzed, stored and executed as cursors. Thus, you will always use a cursor.

    The problem is that languages, such as PL/SQL, provide different interfaces to interact with the SQL cursor. As the ref, the slider interface, the interface DBMS_SQL slider interface and so on.

    Each of these interfaces offers different features. For example, using the interface DBMS_SQL allows binding dynamics and dynamic recovery. The Ref Cursor interface allows your code PL/SQL pass a handle to a reference pointing to the SQL cursor, to an external client. Etc.

    The fundamental reason for the use of an explicit cursor interface is mainly that you own and manage bulk made extraction output provided by PL/SQL cursor.

    With a cursor FOR , the motor loop of PL/SQL optimize the loop by extracting block a 100 lines both. However, you cannot access this collection in bulk directly inside the loop.

    With an explicit cursor interface, you specify the size of the extraction in bulk via the clause LIMIT , and you set the variable of collection to use. This allows you to use the collection directly variable inside the loop.

    However, the need to do - code manually in bulk collection - rarely occur in the daily programs in PL/SQL. A line of treatment is both slow and not well fits. And even if your bulk code collects lines, these lines must still be processed one at a time in your code. It is much more efficient and scalable rather write SQL code, and make the engine SQL the line of treatment for you.

  • Satellite A100-549: BSOD after I used the recovery from another PC

    Hello.

    Had a few probs with my laptop and decided to recover it using another pc recovery disc.
    I get the laptop is a Toshiba a100-549. Unfortunately for some reason I can't disks that were originally with her.

    The opertaing system is Windows xp. The disks I got with a Vista.
    It loads OK but goes to a blue screen after 30 seconds and restarts. Is there a reason for this and can I do.

    I think I may need to get your hands on a good drive and load it on again.
    Someone at - it copies of drives for this laptop and able to send me their. I'll gladly pay for them...

    Colin

    Hello

    Don t user recovery drive to another PC, because it won't work.
    You can use a clean Windows OS disk or the Toshiba recovery disc.

    Why? Because the recovery disk contains an image. The image is a package containing a Windows OS, drivers and other software.
    If you want to use the recovery from another PC disk then all the drivers, tools and software distributed for this PC will be loaded on your Toshiba laptop.
    This can cause the BSOD!

    So if you n t have the Toshiba recovery disc then you should use MS Windows CD!
    Toshiba drivers can be downloaded from the Toshiba page!

  • When I connect to windows it says build 7601 windows not genuine, this could because im using the hardisc in another computer I just built or why it is dislaying this message?

    It maybe because im using the hardisc in another computer I just built, because my other computer motherboard have cooked or why it displays this message?

    Help, please
    Direct them kind
    Mike

    If victory has been pre-installed you can not use this hard disk with this installation of win on another PC

    What is a commercial version of victory that was purchased?

  • HP laptop, 2000 - 2a20CA: Page of the screen shrinks by using the cursor key

    Laptop HP 2000-2a20CA

    No. B5R61UA

    It seems the upgrade from Win 7 to win 10 Home edition, in navigation or by using a Microsoft Office program, the windows Explorer.

    When you move the cursor with the touchpad and then listen to select a link, function etc. anywhere on the screen/page.

    The screen will decrease in size to the left or right of the screen or reduce to the taskbar.

    Clues, there is problem Win 10 or touchpad.

    HP 2000-2a20CA, running Windows 10 laptop

    Thank you

    I think I solved the problem because now I think.

    To check the HP site looking for updates to Win 10 and none were found.

    But then I changed my version of Windows to win 8 then rechecked updates and there is an update for the touchpad dated March 2016.

    Downloaded and installed, and everything seems OK so far.

    Thanks again.

  • Point display XY graph using the cursor data

    Hello all, I use XY graph to display amplitude v/s time. During the vi execution, data are continuously plooted on chart until the user stops the vi. I want to add a feature, such that, during the execution of the vi, when the user clicks on the chart to the situation with the cursor, it should show corresponding value of time and amplitude of this point. I mean the value of the axis corresponding to the category axis not the cursor position. When you use the position of the cursor, it is ok with the x axis, but it shows the cursor position for y axis (as property said), and I want datavalue said not not the position y axis.

    I hope it's clear with the question. I would like to have a few examples... for y = x graphic below, you can see cursor x = 4.4 and y = 6.8, how to view corresponding datapoint which must be y = 4.4

    When creating (or even after you've created), choose "align on the" plot 0.

    Do not let it be 'slide free.

    Attached example.

  • Using the cursor to insert a value

    Hello
    I created a procedure mentioned below, using the slider that I want to insert a value in the table its not to insert any value. You can one to find the solution. I have compiled the procedure there is no errors...

    I have a lot of value in the employee... then after table do not perform the procedures no value in employee_lkp


    My structure from the Employee table is

    CREATE TABLE 'VIDHYA '. "' EMPLOYEE '.
    (
    VARCHAR2 (15 BYTE) "PNOM."
    'MINIT' VARCHAR2 (2 BYTE),
    VARCHAR2 (15 BYTE) "LNAME",.
    ACTIVATE THE "SSN" NUMBER (12.0) NOT NULL,
    "BDATE" DATE,
    'ADDRESS' VARCHAR2 (35 BYTE),
    'SEX' VARCHAR2 (1 BYTE),
    ACTIVATE THE "WAGES" NUMBER (7,0) NOT NULL,
    NUMBER (12.0) "SUPERSSN."
    ACTIVATE THE 'DNO' NUMBER (2.0) NOT NULL,
    ACTIVATE THE STATISTICS STORAGE CALCULATION (INITIAL 65536 THEN 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 USER_TABLES DEFAULT TABLESPACE) 'USERS' CONSTRAINT 'PK_EMPLOYEE' KEY PRIMARY ("SSN") WITH THE HELP OF INDEX PCTFREE 10 INITRANS MAXTRANS 255 2.
    CONSTRAINT 'FK_DEPARTMENT' FOREIGN KEY ('DNO') REFERENCES 'VIDHYA '. "" DEPARTMENT "("DNUMBER") ALLOW
    )


    employee_lkp structure is

    CREATE TABLE 'VIDHYA '. "" EMPLOYEE_LKP ".
    (
    VARCHAR2 (250 BYTE) "PNOM."
    VARCHAR2 (250 BYTE) "LNAME",.
    'ID '.
    )


    create or replace
    procedure employeelkp is
    number of add_val;
    i the number;
    number num.
    add_name cursor is select * from employee;
    name_cur add_name % rowtype;
    Start
    Open add_name;
    Select count (*) in the number of the employee;
    because me in 1.num
    loop
    extract the add_name in name_cur;
    insert into employee_lkp (id, fname, lname)
    values (i,
    name_cur. Lname,
    name_cur.fname);
    When the output add_name % notfound;
    end loop;
    close add_name;
    end employeelkp;

    Try this...
    Add

    commit;
    

    After

    close add_name;

    at the bottom.

    I hope this helps...

    Hamid

  • need to use the cursor for the query

    Hi all
    can someone tell me how to get the result of the following query using the slider?

    SELECT (SUBSTR('        ', 1,LEVEL*2)
      || t1.label) AS t1_label,
      amount
    FROM
      (SELECT t1.label,
        t1.ID,
        t1.parent_id,
        SUM(t2.turnover) AS amount
      FROM t1,
        t2
      WHERE t2.t1_id = t1.id
      AND t2.t1_id  IN
        (SELECT id
        FROM t1
          START WITH t1.ID       = 2
          CONNECT BY PRIOR t1.ID = t1.parent_id
        )
      GROUP BY t1.label, t1.ID, t1.parent_id
      ) t1
      START WITH t1.ID       = 2
      CONNECT BY PRIOR t1.ID = t1.parent_id;
    .. .and the result:
    t1_label             amount
    ---------------------------------------------------------
         B11     11778.54
          B121     19980.28
            B1211     18842.77
            B1212     25480.56
          B122     18339.07
        B12            23455.9
        B13            20876.52
    Thank you
    Alex

    Published by: 860003 on June 9, 2011 01:30

    Published by: 860003 on June 9, 2011 01:31

    Published by: 860003 on June 9, 2011 01:31

    decalare
    V_T1_lable varachar2 (250);
    Number V_AMT;
    cursor c1 is SELECT (SUBSTR (' ', 1, LEVEL * 2))
    || T1. Label) AS t1_label,
    amount
    Of
    (SELECT t1.label,
    T1.ID,
    T1.parent_id,
    Amount of Sum (T2.turnover) AS
    FROM t1
    T2
    WHERE t2.t1_id = t1.id
    AND IN t2.t1_id
    (SELECT id
    FROM t1
    START WITH t1.ID = 2
    CONNECT BY PRIOR t1.ID = t1.parent_id
    )
    GROUP BY t1.label, t1.ID, t1.parent_id
    ) t1
    START WITH t1.ID = 2
    CONNECT BY PRIOR t1.ID = t1.parent_id;

    Start
    Open c1;
    loop
    Fetch c1 into V_T1_lable, V_AMT;
    dbms_output.put_line(V_T1_lable||) e ---'|| V_AMT);
    When Exit C1% notfound

    end loop;
    exception
    When people then
    dbms_output.put_line(SQLCODE||) e --'|| SQLERRM);
    end;

  • How to choose the maximum value in a column of a table by using the cursor and iteration

    Hello everyone
    I have a table loan_detail
    and a column inside loan_amount
    now I want to take the values in this table with the cursor, then using iteration that I want to take a max value of him using this slider
    Here is my table
    LOAN_AMOUNT
    
    100
    200
    300
    400
    500
    5600
    700
    I could make using the concepts of single loop, but when I tried to do by using the slider I wasn't able to do.
    Concerning
    Prost

    You can get the maximum value for a particular column in SQL, PLSQL needn't; Always avoid PLSQL so you can do it in SQL. But always as an example:

    declare
    number of Temp: = 0;
    Start
    for news in some loan_amt of loan_detail
    loop
    If (temp
    end if;
    end loop;
    dbms_output.put_line (temp);
    end;

    Edited by: Mahanam January 5, 2011 03:11

  • Problems to use the cursor to select the format of pdf text precisely

    When you try to select a bit of text that is in a text (as opposed to a text box) on a form object, the cursor highlights several other items of text on the page.

    I'll try to reproduce it below:

    It is just the nature of the documents in pdf format, or is this something that can be avoided.

    I made sure to give each its own name text object, but the problem persists.

    Let's say that I tried to highlight all the end of this sentence.

    Note that the other texts are selected as well.  This would happen in a form when I would try to select only the text: "the end of this sentence."

    Its not impossible to select the text I want in acrobat, but it seems to be very sensitive on the forms. Just to have the cursor slightly outside the central axis of the text, and half of the shape is selected.

    Is it possible to make it more like the text in a text field?

    Thank you!

    Nope!

    It's just the way it is.

    Niall

  • Cycling pictures using the cursor.

    Hi, I am a complete newbie to flash (it took me 10 minutes just to find out where to put actionscript code lol). In any case, I'm doing a flash where you can scroll through the images using a scroll bar. These are images of a face of people of 13 angles from 90 degrees to the left, looking at the Center, right 90 degrees. I want to be able to turn the face using the slider. What I'm trying to do is similar to another thread, I read (but not exactly the same goal) so I took the code from there just to started get me. Currently when I test the movie face moves backward (looping) and the scroll bar does not interact with the images/images. This is the code that I have 1 image 1 layer. I know that this code can be completely wrong for what I wanted to do since I pulled it of someone elses project.

    function f (mc:MovieClip, x 1: number, y1:Number, x 2: Number, y2:Number) {}

    MC.m =(Y1-Y2) /(x1-x2);

    MC.b = Y1 - mc.m * x 1;

    }

    f(mc_slider.mc_handle,mc_slider.mc_rail._x,1,mc_slider.mc_rail._x+mc_slider.mc_rail._width-mc_slider.mc_handle._width,mc_frame000._totalframes);

    {mc_slider.mc_handle.onPress = Function ()}

    this.startDrag (width of false, mc_slider.mc_rail._x, this._y, mc_slider.mc_rail._x + mc_slider.mc_rail. _ - mc_slider.mc_handle._width, this._y);

    clearInterval (current);

    Current = setInterval(dragF,50);

    }

    {mc_slider.mc_handle.onRelease = mc_slider.mc_handle.onReleaseOutside = Function ()}

    this.stopDrag ();

    clearInterval (current);

    }

    function dragF() {}

    frameNum = Math.round(mc_slider.mc_handle.m*mc_slider.mc_handle._x+mc_slider.mc_handle.b)

    trace (mc_frame000 + "" + mc_slider.mc_handle.m + "" + mc_slider.mc_handle.b +"" + frameNum)

    mc_frame000.gotoAndStop (frameNum);

    }

    And this is the code that I put in the symbol for the slider-

    This.PERC = 0;

    {handle.onPress = function ()}

    this.startDrag(true,0,0,rail._width,0);

    {this.onEnterFrame = function ()}

    perc=Math.round(this._x*100/rail._width);

    }

    }

    handle.onRelease = stopDrag;

    handle.onReleaseOutside = stopDrag;

    Any help would be appreciated, thanks!

    Thus, faces is not set on the timeline that contains this code (at the time where the trace() function).

    Click on an empty part of the scene (or behind the scenes) and then click on your movieclip of faces on stage.  in the properties panel, on the left side, type 'faces' without the quotes.

  • How can I use highlighting conditional to assign a cell using the value of another cell

    I would use conditional highlighting on a cell based on the value of another cell.

    For example:

    If K2 is 1, then I would than A4 Green

    Any suggestions?

    Hi louis,.

    This approach is to add a cell to compare your target for:

    Highlight the rule in this case:

    Quinn

  • Counter trigger using the output of another counter

    Hello

    I want to configure my USB-6221 Panel in the next mode

    1 Counter0: Generates impulses in continuous mode.

    2 Counter1: Fires by the impulse of Counter0 (rising edge) and generates a train of 128 pulses with a certain frequency.

    3 DigitalInput: Using the impulses generated by the meter read 128 digital input values

    Cnt0: _____|______________|______________|______________|_________

    Cnt1: ______|||||||||||| _________|||||||||||| _________|||||||||||| __________|||||||||||| ___

    DigIn:___xxxxx___xxxxx___xxxxx___xxxxx___

    The problem is: I can't seem to trigger the Cnt1 using the output of Cnt0.

    If I connect using the Cnt0InternalOutput: I get the error: this connection is not supported by the Board of Directors

    If I connect the trigger for a PFI (e.g. PFI5) I get the error: some resources used Cnt0 (I see no reason why by ok).

    I tried for awhile to do in a different way (I completely mixed my vi) but I did not.

    If anyone has any suggestions please shear them.

    Thank you

    Paul

    Ignore my previous post.

    A mistake is this sample clock: finished sample doesn't seem to work with shutter release in this configuration.

    In any case, I found a way to get around and reach my final goal (the object) with a bath other counters and configuration of digital input.

  • In the command prompt, cannot use the change to another cd drive

    Hello

    At the command prompt, the current directory is c:\Windows, I use the command "cd J:\new", but I still in c:\Windows, is there anyone can understand it? THX.

    CD change directory. You must use J: ENTER to change the player j. "a programmer is just a tool that converts the caffeine in code" Deputy CLIP - http://www.winvistaside.de/

Maybe you are looking for

  • How can I record and watch HDTV on my computer from my recorder HD from Comcast?

    Original title: Comcast tv on windows media player I wonder how to get tv comcast hd dvr service a comcast to windows media player so I can record hd tv and watch TV on my computer. When reserching on how to do what I saw a few problems. on the windo

  • It's about microsoft outlook express 2007 sending mail

    It's about microsoft outlook express 2007. When I send an email from my ms outlook express with somes pictures on this subject, the recipient mail do not visualize the images. How to solve this problem?

  • dv8t "plugged in, not charging".

    I have a HP Pavilion dv8t. In recent weeks, I noticed that the battery in the taskbar indicator shows is no longer a full charge. While it is plugged in, it will display the icon of little next to the battery, but if I mouse over the message is "plug

  • [Playbook] How to group apps for sale?

    Is it possible to combine several files (apps) bar in 1 product so when they buy the product, several applications are installed on the device? THX.

  • Alignment of the audio effect

    HelloWhen I use the denoiser and dehummer effect to remove the whistling and humming coming from the audio, it works but on each element, but you always get hiss/snoring during the first second on each clip.I made the change so that the clips are not