Using an output statement for a delete w/o affecting any oracle error msg

Dear all;
I have a delete statement similar to this below
  delete from tbl_one t
  where t.tbl_one_location = location
  and location not in (select distinct p.issuearea  from tbl_two p);the delete statement is within a package, however what i would like to do is output a simple message to show if the delete was successful meaning that an actual item was deleted and if it wasnt successful output another statement for that.
I have an idea in my mind which is to keep track of the number of items in tbl_one before the deletion and then check the count after deletion and if the count is less, then the deletion was successful...hence output the message. Is this the best way to go about it or is there an easier way to do this.
Thank you, All help is appreciated.

All u need is this -
SQL%ROWCOUNTPlease see the folowing -
SQL> select empno
  2    from emp;
     EMPNO
         1
         2
         3
         4
         5
SQL>
SQL> BEGIN
  2     DELETE FROM emp
  3           WHERE empno = 1;
  4 
  5     IF (SQL%ROWCOUNT > 0)
  6     THEN
  7        DBMS_OUTPUT.put_line (SQL%ROWCOUNT || ' Rows Deleted.');
  8     END IF;
  9  END;
10  /
1 Rows Deleted.
PL/SQL procedure successfully completed.
SQL> select empno from emp;
     EMPNO
         2
         3
         4
         5
SQL> Hope this helps..
Formatted the code..
Edited by: Sri on Mar 22, 2011 8:31 AM

Similar Messages

  • How to use the Output clause for the updated statment

    How to use the output clause for the below update stament,
    DECLARE @MyTableVar table(
        sname int NOT NULL)
    update A set stat ='USED' 
    from (select top 1 * from #A 
    where stat='AVAILABLE' order by sno)A
    Output inserted.sname
    INTO @MyTableVar;
    SELECT sname
    FROM @MyTableVar;
    Here am getting one error incorrect syntax near Output
    i want to return the updated value from output clause

    see
    http://blogs.msdn.com/b/sqltips/archive/2005/06/13/output-clause.aspx
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • When making changes to the I/O buffer size( motu-pci 424) it takes an abnormal length of time for the changes to take affect any ideas?

    when making changes to the I/O buffer size( motu-pci 424) it takes an abnormal length of time for the changes to take affect any ideas?

    A fully loaded one( keep in mind I have had fully loaded projects in the past, and it did not take this long) this was noticed after installing LP8, also major latencey even at 64 buffer size

  • Using a Switch statement for Infix to Prefix Expressions

    I am stuck on the numeric and operator portion of the switch statement...I have the problem also figured out in an if/else if statement and it works fine, but the requirements were for the following algorithm:
    while not end of expression
    switch next token of expression
    case space:
    case left parenthesis:
    skip it
    case numeric:
    push the string onto the stack of operands
    case operator:
    push the operator onto the stack of operators
    case right parenthesis:
    pop two operands from operand stack
    pop one operator from operator stack
    form a string onto operand stack
    push the string onto operand stack
    pop the final result off the operand stack
    I know that typically case/switch statement's can only be done via char and int's. As I said I am stuck and hoping to get some pointers. This is for a homework assignment but I am really hoping for a few pointers. I am using a linked stack class as that was also the requirements. Here is the code that I have:
       import java.io.*;
       import java.util.*;
       import java.lang.*;
    /*--------------------------- PUBLIC CLASS INFIXTOPREFIX --------------------------------------*/
    /*-------------------------- INFIX TO PREFIX EXPRESSIONS --------------------------------------*/
        public class infixToPrefix {
          private static LinkedStack operators = new LinkedStack();
          private static LinkedStack operands = new LinkedStack();
            // Class variable for keyboard input
          private static BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
             // Repeatedly reads in infix expressions and evaluates them
           public static void main(String[] args) throws IOException {
          // variables
             String expression, response = "y";
          // obtain input of infix expression from user
             while (response.charAt(0) == 'y') {
                System.out.println("Enter a parenthesized infix expression.");          // prompt the user
                System.out.println("Example: ( ( 13 + 2 ) * ( 10 + ( 8 / 3 ) ) )");
                System.out.print("Or as: ((13+2)*(10+(8/3))):  ");
                expression = stdin.readLine();     // read input from the user
             // output prefix expression and ask user if they would like to continue          
                System.out.println("The Prefix expression is: " + prefix(expression));     // output expression
                System.out.println("Evaluate another? y or n: ");          // check with user for anymore expressions
                response = stdin.readLine();     // read input from user
                if (response.charAt(0) == 'n') {          // is user chooses n, output the statement
                   System.out.println("Thank you and have a great day!");
                }     // end if statement
             }     // end while statement
          }     // end method main
       /*------------- CONVERSION OF AN INFIX EXPRESSION TO A PREFIX EXPRESSION ------------*/ 
       /*--------------------------- USING A SWITCH STATEMENT ------------------------------*/
           private static String prefix(String expression) {
                // variables
             String symbol, operandA, operandB, operator, stringA, outcome;
               // initialize tokenizer
             StringTokenizer tokenizer = new StringTokenizer(expression, " +-*/() ", true);     
             while (tokenizer.hasMoreTokens()) {
                symbol = tokenizer.nextToken();     // initialize symbol     
                switch (expression) {
                   case ' ':
                      break;     // accounting for spaces
                   case '(':
                      break;     // skipping the left parenthesis
                   case (Character.isDigit(symbol.charAt(0))):      // case numeric
                      operands.push(symbol);                                   // push the string onto the stack of operands
                      break;
                   case (!symbol.equals(" ") && !symbol.equals("(")):     // case operator
                      operators.push(symbol);                                             // push the operator onto the stack of operators
                      break;
                   case ')':
                      operandA = (String)operands.pop();     // pop off first operand
                      operandB = (String)operands.pop();     // pop off second operand
                      operator = (String)operators.pop();     // pop off operator
                      stringA = operator + " " + operandB + " " + operandA;          // form the new string
                      operands.push(stringA);
                      break;
                }     // end switch statement
             }     // end while statement
             outcome = (String)operands.pop();     // pop off the outcome
             return outcome;     // return outcome
          }     // end method prefix
       }     // end class infixToPrefixAny help would be greatly appreciated!

    so, i did what flounder suggested:
             char e = expression.charAt(0);
             while (tokenizer.hasMoreTokens()) {
                symbol = tokenizer.nextToken();     // initialize symbol     
                switch (e) {
                   case ' ':
                      break;     // accounting for spaces
                   case '(':
                      break;     // skipping the left parenthesis
                   case '0':
                   case '1':
                   case '2':
                   case '3':
                   case '4':
                   case '5':
                   case '6':
                   case '7':
                   case '8':
                   case '9':
                      operands.push(symbol);     // push the string onto the stack of operands
                      break;                               // case numeric
                   case '+':
                   case '-':
                   case '*':
                   case '/':
                      operators.push(symbol);     // push the operator onto the stack of operators
                      break;                               // case operator
                   case ')':
                      operandA = (String)operands.pop();     // pop off first operand
                      operandB = (String)operands.pop();     // pop off second operand
                      operator = (String)operators.pop();     // pop off operator
                      stringA = operator + " " + operandB + " " + operandA;          // form the new string
                      operands.push(stringA);
                      break;
                   default:
                }     // end switch statement
             }     // end while statement
             outcome = (String)operands.pop();     // pop off the outcome
             return outcome;     // return outcomeafter this, I am able to compile the code free of errors and I am able to enter the infix expression, however, the moment enter is hit it provides the following errors:
    Exception in thread "main" java.lang.NullPointerException
         at LinkedStack$Node.access$100(LinkedStack.java:11)
         at LinkedStack.pop(LinkedStack.java:44)
         at infixToPrefix.prefix(infixToPrefix.java:119)
         at infixToPrefix.main(infixToPrefix.java:59)
    Any ideas as to why? I am still looking through seeing if I can't figure it out, but any suggestions? Here is the linked stack code:
        public class LinkedStack {
       /*--------------- LINKED LIST NODE ---------------*/
           private class Node {
             private Object data;
             private Node previous;
          }     // end class node
       /*--------------  VARIABLES --------------*/
          private Node top;
      /*-- Push Method: pushes object onto LinkedStack --*/     
           public void push(Object data) {
             Node newTop = new Node();
             newTop.data = data;
             newTop.previous = top;
             top = newTop;
          }     // end function push
       /*--- Pop Method: pop obejct off of LinkedStack ---*/
           public Object pop()      {
             Object data = top.data;
             top = top.previous;
             return data;
          }     // end function pop
       } // end class linked stackEdited by: drmsndrgns on Mar 12, 2008 8:10 AM
    Edited by: drmsndrgns on Mar 12, 2008 8:14 AM
    Edited by: drmsndrgns on Mar 12, 2008 8:26 AM

  • How to read back the output state for digital output or anlog output ?

    I use NI-pci 6221(68PIN) Accquistion card to do measurmet,after i do digital output ,or anlog output ,I find that the output will be maitained by the card.even after i exit my accquistion program.But if i reset the card ,the ouptut also will be reset.
    Now if i don't reset the card ,how can i read back the output state,?

    Hi Mike,
    There is no way for you to internally route an analog output to an analog input. The only solution is to physically connect the two lines together with a wire.
    I came to this conclusion through the following steps:
    1- Start MAX and select the DAQmx device under "Devices and Interfaces>>NI-DAQmx Devices" that you want to internally route signals through.
    2- Click on the "Device Routes" tab on the bottom of the right hand window (It defaults to the "Attributes" tab)
    3- Line up the Source with the Destination to see if the connection can be internally routed (either direct or indirect)
    I came to the above conclusion by following these steps for a PCI-6251 DAQ device (the analog output & input do not exist in the "Device Routes" tab therefore they do not support internal routing), but you should verify this for your specific hardware. Let me know if you have any other questions/concerns.
    Cheers,
    Jonah Paul
    Applications Engineer
    National Instruments
    Jonah Paul
    Marketing Manager, Embedded Software
    Evaluate the LabVIEW RIO Platform! - ni.com/rioeval

  • How can I use a READ statement for the checking date =sydatum?

    Hello,
         I need use a READ statement on an internal table ITAB (with feild var1) and check whether feild var1<= sydatum(i.e. var1 greater than or equal to sy-datum)....how can I implement this??
    Regards,
    Shashank.

    Hi,
    try this short example.
    DATA: BEGIN OF ITAB OCCURS 0,
            DATE LIKE SY-DATUM,
          END   OF ITAB.
    ITAB-DATE = '20000101'. APPEND ITAB.
    ITAB-DATE = '20010101'. APPEND ITAB.
    ITAB-DATE = '20020101'. APPEND ITAB.
    ITAB-DATE = '20030101'. APPEND ITAB.
    ITAB-DATE = '20040101'. APPEND ITAB.
    ITAB-DATE = '20050101'. APPEND ITAB.
    ITAB-DATE = '20060101'. APPEND ITAB.
    ITAB-DATE = '20070101'. APPEND ITAB.
    ITAB-DATE = SY-DATUM.   APPEND ITAB.
    ITAB-DATE = '20080101'. APPEND ITAB.
    LOOP AT ITAB WHERE DATE < SY-DATUM.
      WRITE: / 'before', ITAB-DATE.
    ENDLOOP.
    LOOP AT ITAB WHERE DATE = SY-DATUM.
      WRITE: / 'equal ', ITAB-DATE.
    ENDLOOP.
    LOOP AT ITAB WHERE DATE > SY-DATUM.
      WRITE: / 'after ', ITAB-DATE.
    ENDLOOP.
    Regards, Dieter

  • While deleting the virtual machine .vhd folder -- error msg : the process cannot access the file beacuse it is being used by another process

    When i am trying to delete the Virtual Machine folder/directory i get the below error. Virtual machine is turned off
    V:\>rmdir ME-EXCAS01 /s
    ME-EXCAS01, Are you sure (Y/N)? y
    ME-EXCAS01\ME-EXCAS01\Virtual Machines\1B1FD14E-B3F0-4232-9F96-2A871E879CD6.xml
    - The process cannot access the file because it is being used by another process
    How to delete the whole folder ?
    Thanks

    Also, if your VM has snapshots and you delete it, you must wait for the snapshots to finish merging - the VHD files will be locked until then.
    Brian Ehlert
    http://ITProctology.blogspot.com
    Learn. Apply. Repeat.

  • Software for communicating with ipod is not installed properly error msg

    after trying to install my ipod nano for the first time the error msg came up saying that the software for communicating with the ipod had not been installed correctly and needed to be reinstalled. I have tried deleting and reinstalling the itunes and ipod software and followed the trouble shooting steps from the web page but every time i plug my ipod in after reinstalling the same message comes up. when i try to use the updater a "service error" comes up and apart from restore i have also tried the five r's can someone please help me
    hp pavilion a320a   Windows XP  
    hp pavilion a320a   Windows XP  
    hp pavilion a320a   Windows XP  

    See these for the iPod service error.
    iPod service error.
    Fast user switching in Windows XP is not supported.

  • About Multi-ORG for EBS R12.1.1 .. Oracle error -20001 ORA-20001 APP-FND-02

    I have two questions:
    1. If I have only single organization, Do I need to set up multi-org? We will be using AR, AP, and GL modules only.
    2. Is there any step-by-step process to set up multi-org?
    I am getting error: "Oracle error -20001 ORA-20001 APP-FND-02901. You do not have access to any operating unit. Please check if your profile option MO:Security Profile includes any operating unit or the profile option MO: operating unit is set has been detected in MO_GLOBAL_INIT" when I access any form for Entry.
    Thanks

    1. If I have only single organization, Do I need to set up multi-org? We will be using AR, AP, and GL modules only.Yes.
    2. Is there any step-by-step process to set up multi-org?https://forums.oracle.com/forums/search.jspa?threadID=&q=MultiOrg&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    I am getting error: "Oracle error -20001 ORA-20001 APP-FND-02901. You do not have access to any operating unit. Please check if your profile option MO:Security Profile includes any operating unit or the profile option MO: operating unit is set has been detected in MO_GLOBAL_INIT" when I access any form for Entry.Does this happen to all responsibilities?
    Please see the steps in (ORA-20001: APP-FND-02901 Errors Encountered When "Requests" Tab is Selected from PFT or EPF [ID 859072.1]) to set the profile option at the responsibility level for the responsibility you are trying to access.
    Thanks,
    Hussein

  • IPhone 4 - deleted images, after got low memory error msg rcvd, but available memory has not increased!!

    I have an iPhone 4 16GB. Was recording a video the other day, and got this msg: "Warning: You are running out of disk space. Please delete some photos or videos". Ok, so I had like 5,000+ images in my "camera roll", don't have any other folders. ALOT were from the Internet, when I would hold down on an image, and pick "save image". So, using common sense, I went into camera, under camera roll, then hit arrow icon in bottom left corner, and proceeded to check mark images. Once I had a group, I'd hit delete. I did this several times, until I was left with only about 1/2 the amount of images, which was about 3,000. I rebooted my iphone. I then went into settings> general> about, and looked under available, which still showed only about 100MB available out of 14GB. How is this possible? Now, when I go into camera, the lense won't even open, and I keep getting the same error msg. Maybe 3,000 is still alot, but remember, I had almost 6,000 images before, with NO problems till just a few days ago. So, how do I get my iPhone available memory back, if already deleted images, as instructed???

    You need to connect the iPhone to the computer and import those photos to the computer. Photos are not really supposed to be stored in the camera roll as it can cause problems, as you have already seen. Also, should the iPhone crash, you could lose all of the photos without having a backup of them. Once you have downloaded all the pictures, you should be able to go into Explorer and delete everything out of that folder. Then reset the iPhone and it should clear the memory. The iPhone is probably holding the memory because the Library hasn't updated. A sync would help as it tends to reset things. I've read of other issues with keeping too many photos in the camera roll and issues with saving from the Internet as well, however much of that was in earlier versions of iOS. I believe that has been corrected.
    Once you have imported the photos and deleted them from the camera roll, you can sync them back through iTunes in the Photos tab if you want them on the phone.

  • Using an NDS statement for a SQL stament run only once in a proceudure

    Hi,
    We're using Oracle 11.1.0.7.0.
    I'm going through code written by someone else. In this package they're using NDS for every SQL call whether it gets called multiple times or just once. Is that a good thing?
    I thought NDS was only reserved for SQL statements that get called over and over again in a procedure with possible varying 'WHERE clause' variables and so on...
    Is there ANY benefit to using NDS for SQL queries called only once in a procedure?
    Thanks

    There is no benefit unless you want to turn PL/SQL into SQL*Plus (parse once, run once)
    Procedures exist to make sure : parse at compile time, run many times.
    The code is shooting itself in its own foot.
    Or the developer must have got hold of Tom Kyte's unpublished one chapter book 'How to write unscalable applications'.
    Sybrand Bakker
    Senior Oracle DBA

  • Using animated character states for web navigation

    Hello everyone, can someone please post some links to Adobe Edge samples that are using character/ personality +small animation+ web navigation. This is just an approximate example I am searching for: a cartoon character is holding a sign, on roll over or on press state the sign expands and shows navigation elements to other pages of the website. Has anything like this has been done using Adobe Edge? I can't even find one example of such interactivity, can you believe this?? I remember when I was heavy into Flash (10 year ago) there was a lots of samples of such web navigation elements, whether they were usability friendly it is another question, but wanted to see if anyone has seen a resent implementation of similar concept online using Adobe Edge. Any assistance is greatly appreciated.

    newguy-
    Have you look on youtube.com ?  I recall a tutorial that had a design, when rolled over did something and then opened to another page (It didn't open a navigation like you are wanting but it could be a start.
    As far as doing something like this in Edge, it should be quite simple to do.  You can set triggers to call other items on the stage; so you could create an animation and on mouseOver, have it expand and call a navigation "symbol" that could appear with all working links.
    Setting the links is easy - I'm working on a site that has the navigation buttons "Appear" from under a design at the beginning of the animation and are linked to seperate pages within the site.
    James

  • Errors when using the Call statement for MS SQL Server

    I've tried executing a Stored Procedure using the Call method of Portal 2 Go. But it gets an internal error b/c of it. Any Ideas why and how to resolve?

    Hello,
    Which version of SAP BOBJ XI3.1 you are using?
    What I am aware is BEGIN_SQL was very well working for SQLServer2005 in case of ODBC connection.
    Can you try one thing for SQLServer2008 have a Native driver installed on your client machine and use ODBC connection rather than OLEDB connection.
    If that works fine, its good
    Otherwise you can raise a message for resolving this problem with the support team.
    Thanks,
    Vivek

  • I REALLY need an on/off toggle for the delete video feature. Any Ideas?

    My son has Autism and uses an ipod touch and proloquo2go (AAC communication software) to communicate since he is functionally non-verbal.
    He also has music and videos for entertainment on the ipod. I've been fighting for a year now that he keeps deleting all of his movies and then get's mad that they aren't there. I don't always have the option to resync so this can be very stressful at times. Life in general is stressful on a daily basis with his disorder :-(
    A simple on/off toggle in the settings box for the feature similar to the app deletion toggle would relieve sooooo much stress here but alas, it does not exist.
    For a year now I have been searching for a solution with no luck. I have seen quite a few people with the same problem come up empty as well.
    So, is there any way to make this happen?
    Even an alternative video app with a toggle to disable this feature would work. I've tried quite a few but they all work the same as the stock video player with no video protection.
    I would NOT AT ALL mind paying for such an app or feature if it is, or will be available. I believe there is a market for it as i know of many disabled kids in our global special needs community that use a ipod/ipad as a communication device.
    Any help would be greatly appreciated,
    Sincerely,
    -Michael Sullivan

    Thanks for taking the time to respond. I sent a request to Apple, hopefully they will pitty me and/or maybe others have taken the time to ask the question as well.
    It seems like such a simple thing but it would make such a huge difference for me every day.
    -Mike

  • Migrating to Sharepoint 2013 from 2010 - Can you use the same URL for the Web Application without affecting the 2010 environment?

    Hi,
    I am currently trying to migrate our SharePoint 2010 environment to SharePoint 2013. The first thing I'm doing is creating a 2013 development environment to verify that this migration goes smoothly. I'm also doing this so that we will have a testing environment
    after the upgrade to 2013 is complete. 
    So here is my question: I have a 3 tier farm including; 1 app server, 1 wfe, and 1 sql server. I have made a copy of our SharePoint 2010 database and installed that on our sql server 2012 sever (This new environment is on 3 completely separate servers from
    our 2010 environment). I have also installed the prereqs and configured SharePoint 2013 on the App server and wfe servers, as well as configuring the necessary service applications (I have created a completely new 2013 database where I will migrate my 2010
    database content when I'm ready).
    I am now at the point where I need to create a new web application on the 2013 app server, where I will be migrating the copied 2010 database.  (Also note that we have a 2010 development site called https://[email protected])
    When I go to create a new web application in our 2013 dev environment, can I use the same url (https://[email protected]) to create this web app, or will this screw up our current 2010 dev environment?
    I'm new to SharePoint migrations, so I apologize if this is a stupid question.
    Thanks in advance for any insight you can share on this!
    Boe Barlage

    So, what you are recommending is that before I create a web application in my new 2013 environment, I need go into my hosts file on my 2013 app server and alter it to point to my 2013 wfe.
    Then after I do that, then I can create my new web application on my 2013 app server with the same url as my 2010 testing environment
    (https://[email protected]). 
    Then after that I should be able to access my new sharepoint 2013 environment at the same URL (https://[email protected])?
    I must be missing something.
    In your first reply, you told me to alter the host file on my 2010 app server and point it to my 2010
    wfe (I guess I thought it probably already is). You also told me to alter the host file on my 2013 app server and point it to my 2013 wfe. 
    so I am confused on after I do this, what url would I access my 2010 test environment, and what url would
    I access my 2013 test environment?
    I am fine with having my test environment as a different URL until I am totally ready to roll everything over and kill the 2010 site. But I want to make sure that when I migrate my database, none of the site links are broken.
    I also want to make sure that if I proceed this way, I want to be sure that I will be able to modify the URL to what my 2010 environment is (without a lot of headaches) when I am ready to kill the 2010 site.
    Thanks again for your help, it's much appreciated!
    Boe Barlage

Maybe you are looking for

  • Read Outlook Email and Get Specific Content from Mail with PowerShell

    Hi Everyone, I would like to get full content value by searching in mail body with PowerShell but I stuck at one place in scripting and would required help from your side. Below is my script with description. #Connecting Outlook with below command $O

  • Converting .avi files into .mp4 .mov or any other file type for ipod

    Hello! I've got .avi file and i want to convert it into any playable file for my ipod is there some program? i've checked quicktime links and i ended up at a page with a 30 euro bill... anyways can anyone help me?

  • Openoffice missing shared object file

    I just started having this problem today. When I run soffice from terminal I get this message... /opt/openoffice/program/soffice.bin: error while loading shared libraries: libicuuc.so.36: cannot open shared object file: No such file or directory Can

  • Cannot authenticate without one of two AD controllers

    Hello, we are finally migrating our AD environment. Till migration we had one AD 2003 SP2 AD controller (physical). We have decided to add second controller(VM) based on Windows 2008 R2. Firstly, new AD controller was fully patched with MS update bef

  • My CS2 no longer works

    I have recently been receiving a popup when launching CS2 stating: "This application has failed to start because OFVImgProc.dll was not found.  Re-installing the application did not fix the problem."  Clicking the OK button dismissed the popup and CS