Remove the statement that uses a subselect in the declaration of the cursor

Hi all

How to write write a delete statement that uses a subselect with the declaration of the cursor?

CURSOR excluded_dates IS          
       SELECT TO_TIMESTAMP(report_parameter_value, in_date_format_mask)
      INTO my_current_date_time
      FROM report_parameters
     WHERE report_parameters.report_parameter_id    = in_report_parameter_id
       AND report_parameters.report_parameter_group = 'DATE_TIME'
       AND report_parameters.report_parameter_name  = 'EXCLUDED_DATE';
 OPEN excluded_dates;
  
  LOOP
    
    FETCH excluded_dates INTO my_excluded_date;
    
    EXIT WHEN excluded_dates%NOTFOUND;
    
    DELETE FROM edr_rpt_tmp_inclusion_table
    WHERE TO_CHAR(date_time, 'mm/dd/yyyy') = TO_CHAR(my_excluded_date, 'mm/dd/yyyy');
    
  END LOOP;

  CLOSE excluded_dates;
Thank you

Hello

You can turn your cursor into a subquery IN

DELETE FROM edr_rpt_tmp_inclusion_table
WHERE   TRUNC (date_time) IN
(
       SELECT TRUNC (TO_TIMESTAMP(report_parameter_value, in_date_format_mask))
--      INTO my_current_date_time   -- Remove this line
      FROM report_parameters
     WHERE report_parameters.report_parameter_id    = in_report_parameter_id
       AND report_parameters.report_parameter_group = 'DATE_TIME'
       AND report_parameters.report_parameter_name  = 'EXCLUDED_DATE'
);

I used the TRUNK instead of TO_CHAR, but it works with TO_CHAR.

Published by: Frank Kulash, June 8, 2009 11:28
Remove the "my_current_date_time" line, after Sean and Sanjay (below).

Tags: Database

Similar Questions

  • Select (or remove) the cursor at the end of the wave

    (How) select (or remove) the wave of the current position of the cursor to the end of the wave? (without having to drag the cursor to the end)

    For laptops without the HOME/END keys, use the function + arrow left/right keys.  So SHIFT-FUNCTION-RIGHT selects at the end of the file.

  • How to remove the cursor hourglass?

    After downloading ie8 my cursor is attached to the hourglass. Also, keep to receive a message saying that needs to close my toolbar of the AT and T?

    Hi JoanSchipper,

    ·         The hourglass on the slider appears all the time?

    You can follow the steps to choose a cursor of your choice:

    a. click the Start button and then click on Panel.

    (b) in the Control Panel, make sure you are in Classic view, with all the control panel display icons. If this is not the case, click switch to Classic view in the left pane of the control panel.

    c. click the mouse

    d. click on pointers and select the schema of your choice.

    e. click apply and OK.

    I hope this helps.

  • REQUEST to remove the clause SSELECT

    My version of the database is oracle 12 c.

    I have a table named sql_test, it stores the name of the table and SQL used for this table.

    create table sql_test

    (

    table-name varchar2 (30),

    SQL clob,

    clob sql_no_slct

    );

    INSERT INTO (table_name, sql) sql_test values ('XYZ',' SELECT * () IN OF XYZ Z WHERE Z.ABC)

    SELECT PQR IRD A, PLS B

    (WHERE A.ID = B.ID AND B.STAGE = 209)');

    INSERT INTO (table_name, sql) sql_test values ('ABT',' SELECT * () IN OF ABT WHERE LDD)

    SELECT PQR IRD A, PLS B

    (WHERE A.ID = B.ID AND B.STAGE = 209)');

    commit;

    Now, I need to update the sql_no_clct column. This column value must come from a SQL column but the first part of the slect... Of... is deleted. It starts from after the WHERE clause.

    For example, for the first records table_name = "XYZ" update should be like this: -.

    Update sql_test

    set sql_no_slct ='Z.ABC IN (SELECT IRD OF the PQR, PLS B

    WHERE A.ID = B.ID AND B.STAGE = 209)';

    commit;

    In the above example, I have here the query update with manual changes. In fact, I have several lines in the table so I prefer to take the value of the SQL column and handle to remove the first select... Of... Where the query and update records.

    Please some advice/help on this.

    Thank you.

    When you have an SQL statement that uses different 'values', but are essentially is the same SQL statement, then bind using variable avoids having to one) hard to analyze the statement each time to generate a new execution plan and b) use essential internal resources such as the shared pool to store multiple copies of, what is essentially, the same statement.

    Don't not using bind variables can have an impact on the performance of the query itself as well as the performance of the server for everyone use it somewhere else.

    When you write a SQL, PL/SQL statement, then the values you pass are automatically transformed into bind variable (PL/SQL is smart like that).  When dynamically SQL statements you issue yourself, you must always aim to use bind variables in order to change the values, rather than hard-coding values in the statement.

    for example if your SQL string is:

    "Select empno, comm, sal from emp where empno = 7788'."

    the "7788' so is this value.

    To run this string dynamically using bind variables, you would do something (in PL/SQL) as:

    run immediately "select empno, comm, sal from emp where empno =: 1' using 7788;"

    So, if you need to use a different value, you go just this different value in, but the SQL statement in the shared pool is identical, with the same execution plan and can be soft parsed (rather than hard analysis and put a new entry in the shared pool).

  • Captivate: Keep the cursor in the text entry box

    I would limit the cursor on the input text in a slide area, regardless of where the user can click.

    I am doing a project of training for an application interface text, and I simulate the application entry field by placing a unique text on the slide entry box.  Although the cursor starts in this field when the slide is displayed, if the user can use the mouse to click anywhere but the text entry box, the cursor disappears and the user can enter data until he or she clicks on the text with the mouse input box.  This problem occurs in both the preview and the. Output of the EXE.

    I tried to activate and deactivate the 'click' option under select key... in the parameters text box properties.  I also tried setting the action on the lost update to allow for the text control, or make her display a legend that says "click in the area of selection."  Apparently, remove the cursor of the box isn't enough to trigger the event "has lost the Focus.

    While this isn't a complete show-stopper, it is an irritation that I'd rather not have my users deal with.

    I am using Captivate 4 v4.0.1 build 1658.

    Thanks for any help you can give...

    Hello

    I was able to do the following.

    Insert a box click programmed object to go to the last slide when you click it.

    Insert a text entry box and configure it so that it does not keep the text.

    Insert a blank slide just before the slide with the TEB, then once it is longs.1 seconds. You should also give the same origin as the slide with the TEB. Otherwise, you will see a 'flash', as the previous slide is visited.

    The way this works is that the user clicks anywhere but the BER and transport action click on box to the previous slide. But this slide is really super short. .1 second if it is visited and the read head again enters the slide with the TEB.

    One thing to be aware of, is that if you plan to view the Captivate 'as a whole', which means that you have no idea what browser is used to view it, you must consider the insertion of a button object on the first slide that requires the user to click on it. This way is is moved to the Flash sitting inside the browser object.

    See you soon... Rick

    Useful and practical links

    Captivate wish form/Bug report form

    Certified Adobe Captivate training

    SorcerStone blog

    Captivate eBooks

  • I need to remove the uneeded files: Purenetworks and PCFix. But I get: not deletenmrsrc.dll: access denied make sure the disk is not full or write protected and that the file is not in use.

    Original title: remove unnecessary files

    I need to remove the uneeded files: Purenetworks and PCFix. But I get: not deletenmrsrc.dll: access denied make sure the disk is not full or write protected and that the file is not in use.

    Ditto for PCFIX.exe.

    How can I remove these and clean unnecessary files? Thank you.

    Hello

    1. how exactly you are trying to remove it?
    2 have you connected the administrator account?

    Step 1: Check if the problem persists in the clean boot state.

    From your computer by using a minimal set of drivers and startup programs so that you can determine if a background program is interfering with your game or program. This type of boot is known as a "clean boot".

    Reference:

    How to configure Windows XP to start in a "clean boot" State

    http://support.Microsoft.com/kb/310353

    When you are finished troubleshooting, follow these steps to reset the computer to start as usual:

    1. click on start and then click Run.

    2. type msconfig and click OK.

    The System Configuration Utility dialog box appears.

    3. click on the tab general, click Normal Startup - load all services and device drivers and then click OK.

    4. When prompted, click on restart to restart the computer.

    Step 2: Take possession of these program at the following location folder, and then check the issue. C:\Program Files\ 

    Reference: How is ownership of a file or a folder in Windows XP

  • I have somehow added a splitter to my browser screen. When I open firefox there are 2 screens with separate scroll bars. I do not use the add on feature that allows the separation of the screen. I can't find a command to remove the 2nd screen.

    The left side of my browser's screen has a screen separate with its own scroll bar. I can use the cursor to draw this screen to halfway to the right. It has a separate web page as the main window. I can't find a command to remove it. I had a yahoo toolbar, I thought that may have been involved.

    You can open a Web site in the sidebar.

    Opening in the sidebar is the default value for the bookmarks created via a link or a button on a Web site.

    You can view the properties of a bookmark using the context menu in the side bar (Ctrl + B; Cmd + B on Mac).

    In the Bookmark Manager (Bookmarks > show all bookmarks) you can click on the button more in the lower details pane on the right.

    Make sure "Load this bookmark in the sidebar" is not selected.

  • How can I remove the bookmarks that are no longer used.

    I have a list of bookmarks on firefox. Many are more used.
    How can I remove the individual bookmarls of my list.
    Tried to highlight and delete them, but that does not work...

    You can right click and delete, select and use the key "Delete", or remove
    multiple bookmark click to the left of the favorite icon, and then add more with "Ctrl + click"
    or spread with "Shift + click" then delete.

    You can remove bookmarks as described for the deletion of history in

    http://KB.mozillazine.org/Viewing_the_browsing_history_-_Firefox#Selecting_history_items

    The reference to bookmarks won't in the details, because it is in the article above.

    http://KB.mozillazine.org/Sorting_and_rearranging_bookmarks_-_Firefox

    You will be perhaps easier to delete bookmarks you don't want in the list of the bookmarks library. As noted in the article to bookmark sorting you can view and sort by additional columns, I recommend installing the extension "Show Parent Folder" link is in the article to bookmark, unfortunately that you can add the column is not sortable, but it provides valuable information.

  • I was using iDownloaders browser and a message came your device is infected with a virus. I removed the app from my mini iPad 2 but now I feel crashes especially among angry birds. I want to restore, but I fear that the virus will reinstall.

    I used the iDownloaders app browser, (it is a video download application I use for a few years with no problems), when a message came "your machine is infected with a virus please leave the app and contact Apple." I removed the app from my mini iPad 2, but now I meet including crashes in Angry Birds Seasons and Rio. I want to restore the iPad, but I fear that the virus will reinstall themselves as well. Apple did not contact because I never heard of someone who got a virus using iOS. I took it slightly think to delete the iDownloader app would solve the problem. Im running version 9.2 on a retina mini iPad 2. Maybe someone has an answer on what I can try before you contact Apple. I appreciate any suggestions thanks JohnG

    Unless your iPad is jailbroken, it is not infected.  This notice is a well known scam to a fraudulent web site.  You can restore.

  • While I'm trying to remove the MPEG-4 file, it says "make sure that the disk is not full or write protected and that the file is not currently in use.

    Original title: When I'm trying to delete file MPEG4, is not deletion. How can I delete file MPEG4?

    While I'm trying to remove the MPEG-4 file, it says "make sure that the disk is not full or write protected and that the file is not currently in use.

    Hello
     
    Method 1: Ownership of the file and then try to delete and see if that helps.
    Reference:
    How to capture a file or a folder in Windows XP
    http://support.Microsoft.com/kb/308421
    Method 2:
     
    Error message when you try to delete a file in Windows XP: "access denied".

    http://support.Microsoft.com/kb/298345

  • How to remove the files that are duplicate or use more?

    I had someone me my laptop gift and there are elements, I don't think I'll ever use as Apple store etc. My friend was kind enough to upload my pictures and my videos my sims card phones, but when I look at it is more than once exemplary. I have to remove the duplicates manually? Please say its not then... as well as with my music...

    You can go through them and remove duplicates manually, or there are many programs that can check duplicate files and delete them if you have copies.

    Here are two free programs:

    Auslogics Duplicate File Finder

    http://www.Auslogics.com/en/software/duplicate-file-Finder/

    Duplicate Cleaner
    http://www.digitalvolcano.co.uk/content/duplicate-cleaner

  • I used a cleaning program that has removed the solitaire games that come with the software package of vista. Is it possible to recover?

    original title: OOPS! Remove Solitaire games by mistake

    My husband used a cleaning program that has removed the solitaire games that come with the software package of vista. Is it possible to recover?

    Hi L-959,

    Try to reinstall the game Solitaire to turn on or off Windows features.

    Turn on or off Windows features

  • After the use of any USB device, I stopped the device that comes in the window telling me it is safe to remove the device and then my computer crashes I have to make a difficult start to resume what I was doing. It is on a Toshiba Satellite running Vista

    After the use of any USB device, I stopped the device that comes in the window telling me it is safe to remove the device and then my computer crashes I have to make a difficult start to resume what I was doing.  It is on a Toshiba Satellite running Vista

    Hello

    Follow these steps to remove corruption and missing/damaged file system repair or replacement.

    Start - type in the search box - find command top - RIGHT CLICK – RUN AS ADMIN

    sfc/scannow

    How to analyze the log file entries that the Microsoft Windows Resource Checker (SFC.exe) program
    generates in Windows Vista cbs.log
    http://support.Microsoft.com/kb/928228

    Then, run checkdisk - schedule it to run at next boot, then apply OK your way out, then restart.

    How to run the check disk at startup in Vista
    http://www.Vistax64.com/tutorials/67612-check-disk-Chkdsk.html

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

    Then lets refresh the USB stack

    Control Panel - right CLICK on EVERYTHING - Serial USB controllers - Device Manager and UNINSTALL
    all except the category itself - REBOOT - it refreshes the drive and battery USB

    This KB shows XP how to and the method of Vista is identical
    http://support.Microsoft.com/kb/310575

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

    If necessary try these two:

    Tips for solving problems of USB devices - and a Mr Fixit
    http://windowshelp.Microsoft.com/Windows/en-us/help/c39bd203-f729-47a4-8351-83291e13c8a81033.mspx#EGB

    Hardware devices not detected or not working - Mr. Fixit
    http://support.Microsoft.com/GP/hardware_device_problems

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

    If no joy, see Toshiba Support and/or their forums:

    Toshiba support and drivers
    http://www.CSD.Toshiba.com/cgi-bin/TAIS/support/JSP/home.jsp?NAV=download

    Toshiba Support Forums
    http://laptopforums.Toshiba.com/

    Contact Toshiba
    http://www.CSD.Toshiba.com/cgi-bin/TAIS/support/JSP/navShell.jsp?CF=su_contact

    I hope this helps and happy holidays!
    Rob - bicycle - Mark Twain said it is good.

  • I notice in gold, that says that my trial period is up, I don't know why since I have a copy of Lightroom 6 I used since September 1915. How can I remove the notice?

    I notice in gold that says lightroom Mobile has expired. I have lightroom 6, an upgrade for my lightroom 5. It was purchased in September 1915 and I wasn't aware that I was using the mobile lightroom. What can I do to remove the notice and come back using my lightroom 6?

    With LR 6 means you have a serial number, there should be a way to get by clicking on the license of this software or a similar button on the trial-is-up notification.

  • I need something to smooth out grainy photos and set the color.  I have several photos that I need to use which has a blue cast on them.  Photoshop will remove the color blue?  I need an answer immediately.

    I need something to smooth out grainy photos and set the color.  I have several photos that I need to use which has a blue cast on them.  Photoshop will remove the color blue?  I need an answer immediately.

    Yes, photoshop can remove noise and remove color casts

Maybe you are looking for