When there is a need of END SELECT

Hi,
   give me a clear view about the presence of END SELECT stmt in SELECT query. In some places its not used
                                           Thanks

hi
ENDSELECT
Syntax
ENDSELECT.
Effect
The ENDSELECT statement closes a loop started with SELECT.
A SELECT command for which the INTO|APPENDING [CORRESPONDING FIELDS OF] TABLE itab is inserted into an internal table, must be followed by ENDSELECT if the addition PACKAGE SIZE is used.
For all other SELECT commands, ENDSELECT must be used unless a single line above the addition SINGLE is read after SELECT and unless the columns of the result set are statically specified and contain only aggregate functions without the specification of the addition GROUP BY.
hope it will help u
rahul

Similar Messages

  • Primary key constraint firing when there's no need

    Hi All,
    I've got a very weird problem.
    I've written a PL/SQL procedure to insert addresses into a tabel. The adresses are assigned an unique number by means of a sequence. This unique number is the primary key of the table and has to be unique.
    The following thing occurs: The primary key constraint fires whenever i try to insert a record and i can't figure out why.
    I use the following code
    PROCEDURE mk_adr(klant NUMBER, receiver NUMBER) IS
    oidtje NUMBER DEFAULT 0;
    BEGIN
    BEGIN
    SELECT lea_adr_seq.NEXTVAL INTO oidtje
    FROM dual
    INSERT INTO lea_adr (
    oid, object, streetname,
    housenumber, housealpha, ponumber,
    postcode, cityname, locationdesc,
    province, kind, country_id,
    relation_id, offerrec_id,
    h_trans_van,
    h_geldig_van,
    h_gebruiker
    SELECT oidtje, oidtje, streetname,
    housenumber, housealpha, ponumber,
    postcode, cityname, locationdesc,
    province, kind, country_id,
    null, receiver,
    To_Date('01-01-2000'),
    To_Date('01-01-2000'),
    'conv'
    FROM lea_adr
    WHERE relation_id = klant
    EXCEPTION
    WHEN Others THEN
    conv_algemeen.debugMessage('mk_adr :: '||SQLERRM);
    END;
    END;
    as you can see the very first thing i'm doing is selecting a new unique number into oidtje from the sequence which provides the numbers. Then i use it to insert the record. The insert fails with the primary key constraint firing saying that oid is not filled with an unique number.
    When i do "select max(oid) from lea_adr;" I get a number lower than the number the i get when doing "select lea_adr_seq.nextval from dual;"
    So am i overseeing something or is something very obvious going wrong ?
    Patrick

    Write your procedure like the following and it will work.
    PROCEDURE mk_adr(klant NUMBER, receiver NUMBER) IS
    BEGIN
    INSERT INTO lea_adr (
    oid, object, streetname,
    housenumber, housealpha, ponumber,
    postcode, cityname, locationdesc,
    province, kind, country_id,
    relation_id, offerrec_id,
    h_trans_van,
    h_geldig_van,
    h_gebruiker
    SELECT lea_adr_seq.NEXTVAL, lea_adr_seq.NEXTVAL, streetname,
    housenumber, housealpha, ponumber,
    postcode, cityname, locationdesc,
    province, kind, country_id,
    null, receiver,
    To_Date('01-01-2000'),
    To_Date('01-01-2000'),
    'conv'
    FROM lea_adr
    WHERE relation_id = klant
    EXCEPTION
    WHEN Others THEN
    conv_algemeen.debugMessage('mk_adr :: '||SQLERRM);
    END;
    Using the lea_adr_seq.NEXTVAL more then once in the SAME select will return the same value for both calls.
    SQL> create sequence test
    2 ;
    Sequence created.
    SQL> select test.nextval,test.nextval from dual;
    NEXTVAL NEXTVAL
    1 1
    SQL>

  • How do I stop the "Reset Firefox" prompt appearing when there is no need for it?

    Every time I start Firefox I now get the reset firefox prompt in the status bar:
    "It looks like you haven't started Firefox in a while. Do you want to clean it up .... etc."
    I use Firefox practically every day, so it is not true that I haven't used it in a while. After a bit of research, I read that Firefox may display this prompt if it has diagnosed other problems, particularly with add-ons. I haven't noticed any problems in my normal use, and I don't think that it is reasonable to expect me to wipe all my installed add-ons and then re-install and re-configure them again just to make this annoying prompt go away, when it is not giving me any details about the so-called "problem".
    Is there any way of getting Firefox to tell me what it thinks the problem is so that I can try to fix it? Failing that, can this prompt be disabled completely?

    I have repeated the test with nightly, but this time created the new profile on a local filesystem (ext4 FWIW) rather than an NFS-mounted one. As before the timestamp on .parentlock is not updated when firefox exits, so almost certainly a bug. If there is a problem with permissions/ownership, that problem is created by firefox, so still a bug :-) (given that the profile is a brand new one).
    I'll report this on bugzilla as soon as I can.

  • Block creation of PO when no order is needed

    Hi Expert,
    Do we able to block PO when the material that we order is sufficient enough, no order is needed.
    Thanks,
    Pauline

    Hi,
    When there is no need for purchase order (under the context of enough stock is already available), SAP standard provides Exception number 20 in the MD04 screen under Exception column against the PO. The user can easily understand the message and can delete the line item of the PO.
    Regards,

  • LG G2 When I select share while in the gallery, facebook doesn't come up as an option.  Is there something I need to set up differently?

    LG G2 When I select share while in the gallery, facebook doesn't come up as an option.  Is there something I need to set up differently?

    Did you go to the Playstore and download the Facebook app? Try that and see if that works.
    I don't use FB, but I read somewhere other people having problems with sharing in KK as well. You could try a download like "Andmade share" to see if that works for you if the previous idea doesn't.

  • When i try to print a photo: select file print a box comes up stating ' no available themes' ' there were no themes located. Until at least one theme has been installed this feature will be unavailable. ? My iPhoto and hp printer software is up to date.

    When i try to print a photo: select photo>file>print a box comes up stating 'no available themes' ' There were no themes located. Until at least 1 theme has been installed this feature will be unavailable'. Mac OS X/10.8.3, iPhoto 9.4.3, HP printer driver up to date. Any suggestions? Thanks.

    YOu need to reinstall iPhoto.
    To re-install iPhoto
    1. Put the iPhoto.app in the trash (Drag it from your Applications Folder to the trash)
    2a: On 10.5:  Go to HD/Library/Receipts and remove any pkg file there with iPhoto in the name.
    2b: On 10.6: Those receipts may be found as follows:  In the Finder use the Go menu and select Go To Folder. In the resulting window type
    /var/db/receipts/
    2c: on 10.7 or later they're at
    /private/var/db/receipts
    A Finder Window will open at that location and you can remove the iPhoto pkg files.
    3. Re-install.
    If you purchased an iLife Disk, then iPhoto is on it.
    If iPhoto was installed on your Mac when you go it then it’s on the System Restore disks that came with your Mac. Insert the first one and opt to ‘Install Bundled Applications Only.
    If you purchased it on the App Store or have a Recent Mac you can find it in your Purchases List.

  • SELECT returns no result when there is a default namespace definition inXML

    Hi,
    I have a problem that my select doesn't return any result when there is a default namespace definition in my XML file.
    I'm using oracle 11g release 1
    XML file stored as a binary XML:
    <SIMS xmlns="http://sims.ics.muni.cz" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://sims.ics.muni.cz jh_sims_matricni_vystupy_or.xsd">
    <Vystup Datum="2006-07-18" Typ="2" Nazev="Poslední etapy" PocetStudentu="1" PocetStudii="2">
    <Student RodneCislo="8001011001">
    <Jmeno>Petr</Jmeno>
    </Student>
    </Vystup>
    </SIMS>
    This select return no result:
    SELECT student.jmeno FROM jh_sims_bin_no_schema s, XMLTable('/SIMS/Vystup/Student' PASSING s.OBJECT_VALUE COLUMNS jmeno VARCHAR2(10) PATH 'Jmeno') student
    When I remove default namespace definition (xmlns="http://sims.ics.muni.cz") everything works fine and the same SELECT returns "Petr". Also when the file is stored in object relational storage everything works fine!
    <SIMS xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://sims.ics.muni.cz jh_sims_matricni_vystupy_or.xsd">
    <Vystup Datum="2006-07-18" Typ="2" Nazev="Poslední etapy" PocetStudentu="1" PocetStudii="2">
    <Student RodneCislo="8001011001">
    <Jmeno>Petr</Jmeno>
    </Student>
    </Vystup>
    </SIMS>
    Thanks for any help!
    Jan Hruby

    Hi Jan,
    You need to specify the default namespace of the document in the XMLNamespaces clause :
    SELECT student.jmeno
    FROM jh_sims_bin_no_schema s,
         XMLTable(
          XMLNamespaces(default 'http://sims.ics.muni.cz'),
          '/SIMS/Vystup/Student'
          PASSING s.OBJECT_VALUE
          COLUMNS jmeno VARCHAR2(10) PATH 'Jmeno'
         ) student
    ;

  • When to use SELECT and END SELECT in the query.

    hi all,
    When to use SELECT and END SELECT in the query.
    regads,
    Venkata Suresh Penke.

    Hi Suresh..
    When do we need to use SELECT .. ENDSELECT
    Usually we will never use SELECT .. ENDSELECT as it gives very poor performance.
    But whenever we read a single Record we will use it as an alternative for SELECT SINGLE in some scenarios.
    Eg: When the Full primary key is not specified in the WHERE clause.
    SELECT * FROM MARC INTO WA_MARC UP TO 1 ROWS WHERE MATNR = P_MATNR.
    ENDSELECT.
    And other scenario is when we perform AGGREGATE OPERATIONS.when the Result is only one row.
    SELECT SUM( LABST ) FROM MARD INTO V_LABST UP TO 1 ROWS
    WHERE MATNR = P_MATNR.
    ENDSELECT.
    Note: In The Above scenario we cannot use SELECT SINGLE..
    <b>REWARD IF HELPFUL.</b>

  • How to find Latch and what actions need to be taken when there is a latch

    Hi
    Can you please tell me how to find Latch and what actions need to be taken when there is a latch?
    Thanks
    Regards,
    RJ.

    1. What is a latch?
    Latches are low level serialization mechanisms used to protect shared
    data structures in the SGA. The implementation of latches is operating
    system dependent, particularly in regard to whether a process will wait
    for a latch and for how long.
    A latch is a type of a lock that can be very quickly acquired and freed.
    Latches are typically used to prevent more than one process from
    executing the same piece of code at a given time. Associated with each
    latch is a cleanup procedure that will be called if a process dies while
    holding the latch. Latches have an associated level that is used to
    prevent deadlocks. Once a process acquires a latch at a certain level it
    cannot subsequently acquire a latch at a level that is equal to or less
    than that level (unless it acquires it nowait).
    2. Latches vs Enqueues
    Enqueues are another type of locking mechanism used in Oracle.
    An enqueue is a more sophisticated mechanism which permits several concurrent
    processes to have varying degree of sharing of "known" resources. Any object
    which can be concurrently used, can be protected with enqueues. A good example
    is of locks on tables. We allow varying levels of sharing on tables e.g.
    two processes can lock a table in share mode or in share update mode etc.
    One difference is that the enqueue is obtained using an OS specific
    locking mechanism. An enqueue allows the user to store a value in the lock,
    i.e the mode in which we are requesting it. The OS lock manager keeps track
    of the resources locked. If a process cannot be granted the lock because it
    is incompatible with the mode requested and the lock is requested with wait,
    the OS puts the requesting process on a wait queue which is serviced in FIFO.
    Another difference between latches and enqueues is that
    in latches there is no ordered queue of waiters like in enqueues. Latch
    waiters may either use timers to wakeup and retry or spin (only in
    multiprocessors). Since all waiters are concurrently retrying (depending on
    the scheduler), anyone might get the latch and conceivably the first one to
    try might be the last one to get.
    3. When do we need to obtain a latch?
    A process acquires a latch when working with a structure in the SGA
    (System Global Area). It continues to hold the latch for the period
    of time it works with the structure. The latch is dropped when the
    process is finished with the structure. Each latch protects a different
    set of data, identified by the name of the latch.
    Oracle uses atomic instructions like "test and set" for operating on latches.
    Processes waiting to execute a part of code for which a latch has
    already been obtained by some other process will wait until the
    latch is released. Examples are redo allocation latches, copy
    latches, archive control latch etc. The basic idea is to block concurrent
    access to shared data structures. Since the instructions to
    set and free latches are atomic, the OS guarantees that only one process gets
    it. Since it is only one instruction, it is quite fast. Latches are held
    for short periods of time and provide a mechanism for cleanup in case
    a holder dies abnormally while holding it. This cleaning is done using
    the services of PMON.
    4. Latches request modes?
    Latches request can be made in two modes: "willing-to-wait" or "no wait". Normally,
    latches will be requested in "willing-to-wait" mode. A request in "willing-to-wait" mode
    will loop, wait, and request again until the latch is obtained. In "no wait" mode the process
    request the latch. If one is not available, instead of waiting, another one is requested. Only
    when all fail does the server process have to wait.
    Examples of "willing-to-wait" latches are: shared pool and library cache latches
    A example of "no wait" latches is the redo copy latch.
    5. What causes latch contention?
    If a required latch is busy, the process requesting it spins, tries again
    and if still not available, spins again. The loop is repeated up to a maximum
    number of times determined by the initialization parameter SPINCOUNT.
    If after this entire loop, the latch is still not available, the process must yield
    the CPU and go to sleep. Initially is sleeps for one centisecond. This time is
    doubled in every subsequent sleep.
    This causes a slowdown to occur and results in additional CPU usage,
    until a latch is available. The CPU usage is a consequence of the
    "spinning" of the process. "Spinning" means that the process continues to
    look for the availability of the latch after certain intervals of time,
    during which it sleeps.
    6. How to identify contention for internal latches?
    Relevant data dictionary views to query
    V$LATCH
    V$LATCHHOLDER
    V$LATCHNAME
    Each row in the V$LATCH table contains statistics for a different type
    of latch. The columns of the table reflect activity for different types
    of latch requests. The distinction between these types of requests is
    whether the requesting process continues to request a latch if it
    is unavailable:
    willing-to-wait If the latch requested with a willing-to-wait
    request is not available, the requesting process
    waits a short time and requests the latch again.
    The process continues waiting and requesting until
    the latch is available.
    no wait If the latch requested with an immediate request is
    not available, the requesting process does not
    wait, but continues processing.
    V$LATCHNAME key information:
    GETS Number of successful willing-to-wait requests for
    a latch.
    MISSES Number of times an initial willing-to-wait request
    was unsuccessful.
    SLEEPS Number of times a process waited a requested a latch
    after an initial wiling-to-wait request.
    IMMEDIATE_GETS Number of successful immediate requests for each latch.
    IMMEDIATE_MISSES Number of unsuccessful immediate requests for each latch.
    Calculating latch hit ratio
    To get the Hit ratio for latches apply the following formula:
    "willing-to-wait" Hit Ratio=(GETS-MISSES)/GETS
    "no wait" Hit Ratio=(IMMEDIATE_GETS-IMMEDIATE_MISSES)/IMMEDIATE_GETS
    This number should be close to 1. If not, tune according to the latch name
    7. Useful SQL scripts to get latch information
    ** Display System-wide latch statistics.
    column name format A32 truncate heading "LATCH NAME"
    column pid heading "HOLDER PID"
    select c.name,a.addr,a.gets,a.misses,a.sleeps,
    a.immediate_gets,a.immediate_misses,b.pid
    from v$latch a, v$latchholder b, v$latchname c
    where a.addr = b.laddr(+)
    and a.latch# = c.latch#
    order by a.latch#;
    ** Given a latch address, find out the latch name.
    column name format a64 heading 'Name'
    select a.name from v$latchname a, v$latch b
    where b.addr = '&addr'
    and b.latch#=a.latch#;
    ** Display latch statistics by latch name.
    column name format a32 heading 'LATCH NAME'
    column pid heading 'HOLDER PID'
    select c.name,a.addr,a.gets,a.misses,a.sleeps,
    a.immediate_gets,a.immediate_misses,b.pid
    from v$latch a, v$latchholder b, v$latchname c
    where a.addr = b.laddr(+) and a.latch# = c.latch#
    and c.name like '&latch_name%' order by a.latch#;
    8. List of all the latches
    Oracle versions might differ in the latch# assigned to the existing latches.
    The following query will help you to identify all latches and the number assigned.
    column name format a40 heading 'LATCH NAME'
    select latch#, name from v$latchname;

  • Keynote and pages are now free, but why do i need to pay for them still when there now free?!?

    keynote and pages are now free, but why do i need to pay for them still when there now free?!?

    Users can obtain the iWorks and iLife applications free, if they purchased a Mac after the beginning of October 2013.
    Older Mac purchases require a paid purchase of these applications.

  • HT4623 I have a Gen 4 Ipod Touch, it is still running with IOS 4. When i go to my settings and select General there is no Software Update button to choose from. How do i update my Ipod to the new IOS system?

    I have a Gen 4 Ipod Touch, it is still running with IOS 4. When i go to my settings and select <General> there is no <Software Update> button to choose from. How do i update my Ipod to the new IOS system?

    You have to hook it up to a computer and update it to ios 5 and then there will be a "software update" button.

  • When I call someone using FaceTime from my mac, they can see me but no hear me. Is there something I need to do to make this happen? I also have an iPad 2 and FaceTime works great on it if I call somebody. Why no sound from my mac FaceTime using a mac pro

    When I call someone using FaceTime from my mac, they can see me but not hear me. Is there something I need to do to make this happen? I also have an iPad 2 and FaceTime works great on it if I call somebody. Why no sound from my mac FaceTime using a mac pro and isight camera, mike combo.
    If I use google it works. If I use Ichat, it works. If I use skype it works.

    This sounds like something similar to https://discussions.apple.com/thread/3388112?start=105&tstart=0.
    Try turning down the speak volume (System Preferences->Sound->Output->Output Volume)  or the microphone gain (System Preferences->Sound->Input->Input Volume). Do this on both sides of the call.

  • Is there a way to open a file when it says it needs DMR?

    Is there a way to open a file when it says it needs DMR?

    Maybe you can let her play on your computer where it may be easier to restrict what she can do, provided there's an OS X equivalent. Of course supervision is probably the safest solution until she is old enough to understand she shouldn't do anything that's not permitted. But then she'd probably be old enough not to need to learn her ABSs.

  • I have a macbook and when I power it on and then select myself as a user...It won't power up. It stays in the white screen with the apple logo. I am online currently under 'guest user'. Is there anything I can do from the keyboard to fix this??? Help!!!

    I have a macbook and when I power it on and then select myself as a user...It won't power up. It stays in the white screen with the apple logo. I am online currently under 'guest user'. Is there anything I can do from the keyboard to fix this??? Help!!!

    Could you specify the model of MacBook and the OS X it's running, please? Some of the advice or references vary along with the system, so this could be helpful to formulate a reply. I've never used a Guest User selection, but do have more than one User.
    If the computer does not have an optical drive, you may be able to boot it into a recovery disk mode or something; in an attempt to see what is wrong and maybe fix it.
    Good luck & happy computing!

  • How can I delete apps from the app store? There seems to be every app I have ever downloaded and deleted since I got my phone in 2007. When I go to app store and select update apps there's a menu at the top that says purchased! I would like to delete hist

    How can I delete apps from the app store? There seems to be every app I have ever downloaded and deleted since I got my phone in 2007. When I go to app store and select update apps there's a menu at the top that says purchased and when I select it it shows every app I've ever had! I would like to delete the history please.
    Many thanks

    You cannot.
    The entire point of this is that you can redownload any and all of your past purchases.

Maybe you are looking for