Is it necessary that 'we should select count (*)' before deleting the recor

Hai...

I need to delete a record in my application for which I wrote a process of pl/sql below...

DECLARE

Symbol varchar2 (20);
CTN number (1);

BEGIN

Symbol: =: P1_HIDDEN_FLAG;
Select count (*) in ctn to emp1 where EMPNO = symbol;

If NTC > 0 then
Remove from emp1 where EMPNO = symbol;

End if;
End;


why we must select count (*) table... If we try to remove a record that is not available in the table... How can we handle this Exception? There are also that "we should select count () before you delete the record from the table... *"

Please tell me...

David...

Hello

You can use SQL % number of LINES:

delete from emp where empno = p;
if sql%rowcount = 0
then -- Nothing deleted!
end if;

Greetings,
Roel

http://roelhartman.blogspot.com/
http://www.bloggingaboutoracle.org/
http://www.Logica.com/

Tags: Database

Similar Questions

  • What consideration we should have have before creating the tablespace

    Hello
    I was asked this question in an interview. I have a large volume of data (for example 80 GB). Now, I have to create a tablespace to contain these data. What consideration we should have have before creating the tablespace.
    In fact, I could not answer after a lot of research, so I post here.

    Concerning

    Hello

    In 10g, you must create a locally managed Tablespace (MEASURE of the LOCAL MANAGEMENT) If you know the
    size of your Tables/indexes you can choose the size of the scale with the option of UNIFORM SIZE.
    If you have small and large Tables / Index, then choose the AUTOALLOCATE option.

    It is recommended to use SAMS with the SEGMENT SPACE MANAGEMENT AUTO option and then the PCTUSED
    is auto tune by an internal algorithm and FREELIST are managed by a bitmap. With this option, it is best to
    be with the last group of hotfixes.

    About BIGFILE Tablespace, if you use BIGFILE tablespace, you will have just a data file which can extend up to
    4G block (thus 32 TB if you have db_block_size = 8KB). And SQL syntax allow you to manage the 'big' with data file
    the same command for the Tablespace.

    But you should care the limit of your OS. Imagine that your operating system or the file system does not support very largefiles then,
    you have no advantage over the use of Bigfile tablespace. Also, you might have more than 1 data file.

    Smallfile Tablespace using your data files should not exceed 4M block (so 32 GB for 8 KB / block) but you can have
    up to 1022 datafiles on your Tablespace. So eventually, if you use the 1022 data files, you have the same capacity
    Bigfile Tablespace and you can use several system files.

    To 80 GB with 3 or 4 data files, you can easily manage this volume. But of course from time to time you will have to
    Add a new data file.

    Hope this can help.
    Best regards
    Jean Valentine

  • I just bought 12 elements. Should I uninstall before installing the elements 12 Elements 6?

    I just bought 12 elements. Should I uninstall before installing the elements 12 Elements 6?

    Hi Dm606,

    You don't need to uninstall Photoshop Element 6 before installing

    Photoshop SetupUpdates12.

    However, it's totally your voluntary decision to uninstall PSE6 but he won't give you any

    problem if the versions coexist.

    I hope this helps.

    Please let me know if you have any further questions.

    Kind regards

    Sumit Singh

  • Select all to delete the email

    How do I "select all" delete several emails?

    At this point, you can't.  K-9 Mail is an application that is in beta version that says he will be able, but it says in the description of this application that you should not run it constantly due to problems with her right now.  Sometimes in a near future we should have hopefully an application with this feature.

  • I'm trying to import a MP4 movie, select clips, then delete the rest.  I cannot import and may not know how to remove the rest after.  Any ideas?

    Selection of Clips from movies MP4, and then deleting the rest.

    It is not possible to cut media unwanted clips in an event.  I guess this is consistent with the principle of a non-destructive editor - the imported media raw is not editable.  If you want to use only small pieces of a long video, you need to split them into separate clips before import into FCP X.  This can be done for example using Quicktime Player.

    Geoff.

  • 2 qs Q: PRIMARY should a compact before deleting email TB or vice versa

    HELLO, MY MAIN QUESTION: apparently the compaction is part of the deletion. But a Compact before email to remove TB or Vice Versa or does it matter which comes first?

    NOTE SECONDARY & QUESTION; I read the article on the compaction, but don't always know exactly what means this word-(e.g. it means compression and why it is absolutely necessary for the deletion? In this regard article compaction TB indicates that in the RELEVANT part. "IF the message is marked as DELETED, or moved, Thunderbird that IGNORES message and moves to the next message". The previous quote seems to say that the compaction is not part of a deletion, but I know (or think you know) that deleting an email and compaction it are necessary for its TOTAL ABOLITION in TB. Can someone explain this apparent contradiction? (I used to use Outlook and I do not remember the term 'compaction' with this system).

    NO ANSWER TO EACH QUESTION WOULD BE GREATLY APPRECIATED. Thank you

    Deleting a message it marks for deletion and cache. Compaction in fact it removes and frees up disk space. Delete then compact.

    Despite the bad name compaction has nothing to do with file compression as zipping them.

  • Exploit: Java / CVE-2010-840. AH, Malware partially stilll in my computer, what should I continue to delete the rest

    I just found out that I was spreading a virus via my computer to everyone on my e-mail list. my computer was sending *. I ran the scan of Microsoft, which had partially removed the virus but my computer may still be infected. The offender's FEAT: Java / CVE-2010-84. AG. Suggestions on how to get the rest? I use AVAST security system and my Basic for microsoft firewall, I use more? and how we remove older versions of Java?

    Hi Christine,

    ·         Microsoft safety scanner are you referring?

    ·         You have the latest updates for Avast?

    Method 1: Check if you have run this scanner. Check out the following link to do the same thing.

    Microsoft Safety Scanner - free online tool for PC health and safety

    Method 2: Check if you have the latest definitions for Avast. Log of Avast Web site.

    Method 3:

    Step 1: To uninstall older versions, see the following link.

    Why should I remove old versions of Java in my system?

    Step 2: To install the latest version, visit the following link.

    Download the free Java software

  • How to remove shortcuts that are on my desktop without deleting the program?

    HP pavilion g series

    Hello

    You can just right click on a shortcut on the desktop, select Remove and click Ok - this will not remove the program with which it is associated.

    Kind regards

    DP - K

  • How to delete the history of google, tried to delete the browsing history, that works, but it does not delete the site from google (in the middle of the page next to the images and videos

    How to delete the history in the Google search box in the middle of the page under Web new video Images

    http://www.Google.com/support/WebSearch/bin/answer.py?hl=en&answer=465

    See if help above.

    See you soon.

    Mick Murphy - Microsoft partner

  • How to remove a password from a router have not used in like 4 years should be able to delete the password or reset it if I can put something new on it

    I have not used in like 4 years must either be able to clear the password or reset it if I can put something new on it. try to get the password required to connect to the web on a new device and can not remember the password I want to erase the password he please someone help me!

    Is what kind of router? Most routers have a reset on the back of them, you'll need something like a paper clip or pen to press the button. Basically you hold down the button for like 10 seconds, and all the lights start flashing, when this happens, you can stop it by pressing the button. When everything goes back to normal, we must reset factory default mind. The default ip address is usually 192.168.0.1 or 192.168.1.1, the username is usually admin and the password is password. Sometimes these are the admin admin, or admin without password, or no username and admin or password for the password. However it may be something completely different. If you have the make and model, I can tell you with certainty what it is :D

  • Should I uninstall before installing the CS3 CS6? [was: your Limburg]

    Do I have to uninstall CS3 and extras, applications before installing the CS6?

    No, you can keep the CS3 files if you think you might need to work with them again.

  • Should I renew before getting the cc apps?

    I have the monthly creative cloud. CC apps will become automatically available. Or I need to change my subscription?

    You don't need to change your subscription. New applications will be available on June 17 by the announcement during the MAX Conference today.

  • should I uninstall before installing the creative suite cs5 cs3?

    just a question will probably not uninstall because I don't want to wait for the answer... I want to do it now

    You don't need to uninstall CS3 before installing CS 5. Many people keep several versions of the suite on their computer. However, you probably want to uninstall the Acrobat component, since you can't run a version of Acrobat on a Windows computer without running into problems. If you have a Mac there is no problem.

  • What is the difference between count (1) selection of the tab and select count (*) tab;

    What is the difference between count (1) selection of the tab and select count (*) tab;

    994122 wrote:

    Hello

    SQL > set timing on

    SQL > select count (*) of the emp

    2 where deptno = 30;

    COUNT (*)

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

    6

    Elapsed time: 00:00:00.01

    SQL > select count (1) of the emp

    2 * where deptno = 30

    SQL > /.

    COUNT (1)

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

    6

    Elapsed time: 00:00:00.01

    See that both give the same time

    Do you really think the 100th's of a second it takes 6 rows from counting will truly representative of the difference it takes actually?

    Such a small data set cannot possibly show no difference to these larger units of time (in the calculation of terms where we have millions of instructions per second in lieu)

    As the link to the FAQ provided in the response of Anton (first response on this thread) Watch, count (1) and count (*) are essentially the same, except that count (1) actually get re-written by the query re - write the step of the optimization to make it count (*).

    Generally 'count (*)' makes more sense language, because it reads like "count" while "count (1)" reads as "count we ', which does not have as much good sense when you actually count all.

  • Select count (1) vs count (*) select

    I apologize if this has been requested previously. Can someone tell me what is the difference between
     select count(1) from <mytable> 
    as opposed to
      select count (*) from <mytable> 
    ?

    Thank you

    Select count (1) in the table

    is faster than

    Select count (*) in the table

    but as long as it is to write the statement - reason: you don't have to hit the shift key for writing a 1, while you need the SHIFT key to get a * ;-)

Maybe you are looking for

  • Guarantee problem - refund offered, never received!

    Event ID: E61530827 In July (!) I returned my product under warranty, after that he failed. I was told later by the Sony support my product would not be repaired or exchanged and that I would receive a refund of $199.99. I followed all the instructio

  • HP Pavilion dv6883cl drivers XP Pro Media Center

    Please, I need the drivers for HP Pavilion dv6883cl. It comes with Windows Vista Home Premium 64-bit, and I have XP Pro Media Center (SP 3) installed on another partition. I need especially the GeForce driver. Thank you guys!

  • Split x 2 disconnect

    Product name: HP Split x 2 A brief description of the problem: undocking Tablet safely

  • How to disable vibration for the Windows (R7-572) key?

    Hello I am the proud owner of a R7-572, which has a Windows button under the screen. I would turn off the vibration that is when I press it. No idea how to do it? Happy new year to all! 2 comments: -J' have already disabled the vibrations made when y

  • When booting computer error says "frequency out of range" in Vista

    I tried to play the fortress team 2 out of steam when he says "frequency out of range" when he started. I restarted my computer, he got to the start screen, but with the screen that he always says "Frequency out of range" there is sound but no screen