IF-ELSE issue in Select Statement

Hello,
I have following query in SQL Server which I am trying to convert to Oracle 11g.
IF '[Param.1]' = 'S' OR '[Param.1]' = 'T' THEN
select * from ULQUEUE
END IF
But when I write the same query in Oracle, it gives error stating Invalid SQL Statement. So how do I incorporate IF-ELSE in Select Statement in Oracle?
Edited by: 967327 on Oct 31, 2012 2:01 PM

Hi,
First of all, remove asterisk sign from the end of line
select * from ULQUEUE;* Second: where you try to put this code? This is not SQL, but PL\SQL so you have to have some variable where you want to put query result like this:
declare
x ULQUEUE%Rowtype;
begin
select *
into    x
from ULQUEUE
end; This of course works when your query returns only one row. Otherwise process data in the loop or put result into array.

Similar Messages

  • Performance Issue in Select Statement (For All Entries)

    Hello,
    I have a report where i have two select statement
    First Select Statement:
    Select A B C P Q R
         from T1 into Table it_t1
              where ....
    Internal Table it_t1 is populated with 359801 entries through this select statement.
    Second Select Statement:
    Select A B C X Y Z
         from T2 in it_t2 For All Entries in it_t1
              where A eq it_t1-A
                 and B eq it_t1-B
                 and C eq it_t1-C
    Now Table T2 contains more than 10 lac records and at the end of select statement it_t2 is populated with 844003 but it takes a lot of time (15 -20 min) to execute second select statement.
    Can this code be optimized?
    Also i have created respective indexes on table T1 and T2 for the fields in Where Condition.
    Regards,

    If you have completed all the steps mentioned by others, in the above thread, and still you are facing issues then,.....
    Use a Select within Select.
    First Select Statement:
    Select A B C P Q R package size 5000
         from T1 into Table it_t1
              where ....
    Second Select Statement:
    Select A B C X Y Z
         from T2 in it_t2 For All Entries in it_t1
              where A eq it_t1-A
                 and B eq it_t1-B
                 and C eq it_t1-C
    do processing........
    endselect
    This way, while using for all entries on T2, your it_t1, will have limited number of entries and thus the 2nd select will be faster.
    Thanks,
    Juwin

  • If-then-else in a select statement

    hi, is it possible to make a if-then-else in a select query, something like:
    select name, age, if(sex=f,1,2) as my_columnn from table1;
    thx.

    Hallo,
    yes it is possible:
    1. with decode
    select name, decode(sex, 'f',1,2) as your_column from table1;
    2. with case
    select name, case when sex='f' THEN 1 ELSE 2 END) as your_column from table1;
    Regards
    Dmytro

  • Performance Issue in select statements

    In the following statements, it is taking too much time for execution,Is there any best way to change these selection statements...int_report_data is my final internal table....
    select fsplant fvplant frplant fl1_sto pl1_delivery pl1_gr pl2_sto           pl2_delivery perr_msg into (dochdr-swerks,dochdr-vwerks,dochdr-rwerks,dochdr-l1sto,docitem-l1xblnr, docitem-l1gr,docitem-l2sto,  docitem-l2xblnr,docitem-err_msg) from zdochdr as f inner join zdocitem as p on fl1_sto  =  pl1_sto where fsplant in s_werks and
    fvplant in v_werks and frplant  in r_werks and pl1_delivery in l1_xblnr and pl1_gr in l1_gr and p~l2_delivery in l2_xblnr.
    move : dochdr-swerks    to  int_report_data-i_swerks,
            dochdr-vwerks    to  int_report_data-i_vwerks,
            dochdr-rwerks    to  int_report_data-i_rwerks,
            dochdr-l1sto     to  int_report_data-i_l1sto,
            docitem-l1xblnr  to  int_report_data-i_l1xblnr,
            docitem-l1gr     to  int_report_data-i_l1gr,
            docitem-l2sto    to  int_report_data-i_l2sto,
            docitem-l2xblnr  to  int_report_data-i_l2xblnr,
            docitem-err_msg  to  int_report_data-i_errmsg.
            append int_report_data.
        endselect.
    Goods receipt
    loop at int_report_data.
    select single ebeln from ekbe into l2gr where ebeln = int_report_data-i_l2sto and bwart = '101' and bewtp = 'E' and vgabe = '1'.
    if sy-subrc eq 0.
           move l2gr to int_report_data-i_l2gr.
           modify int_report_data.
       endif.
    endloop.
    first Billing document (I have to check fkart = ZRTY for second billing *document..how can i write the statement)
    select vbeln from vbfa into (tabvbfa-vbeln) where vbelv = int_report_data-i_l2xblnr or vbelv = int_report_data-i_l1xblnr.
    select single vbeln from vbrk into tabvbrk-vbeln where vbeln = tabvbfa-vbeln and fkart = 'IV'.
      if sy-subrc eq 0.
             move tabvbrk-vbeln to int_report_data-i_l2vbeln.
             modify int_report_data.
       endif.
       endselect.
    Thanks in advance,
    Yad

    Hi!
    Which of your selects is slow? Make a SQL-trace, check which select(s) is(are) slow.
    For EKBE and VBFA you are selecting first key field - in general that is fast. If your z-tables are the problem, maybe an index might help.
    Instead of looping and making a lot of select singles, one select 'for all entries' can help, too.
    Please analyze further and give feedback.
    Regards,
    Christian

  • Time issue of select statement

    Hi friends,
       I have a doubt about select single statement in this particular statement below.
    i have the code which goes this way.
    loop at itab.
    concatenate *year *materail no * item type into dummy variable.
    select single dmbtr from bsis into itab-dmbtr where xref3 = dummy variable and belnr = itab-migodoc and gjahr = itab-mjahr and hkont = '0000123'.
    clear dummy variable.
    modify itab.
    endloop.
    the bsis table has around 4,000,000 records.
    The report when executed goes smoothly till the point where the above select statement is encountered.
    my question is does it take time to execute because of so many records ?
    If not then why dies it take a lot of time to execute a single select statement ? 
    and how can i optimise the time consumed by this select query or report. ?
    Thank you.
    Moderator message: please understand the basic concept of using primary or secondary indexes in your queries, you will sure find the missing field in your where-clause, read the sticky threads of this forum.
    Edited by: Thomas Zloch on Nov 20, 2010 5:31 PM

    Hi Vivek,
    Data volume definitely gives impact on SQL.
    Don't use sql inside the loop, it will decrease the performance.
    Year material no. and item type may have duplicate entries. filter that. It may also gives impact on performance.
    Write a single Select query.
    Instead of fetching the data at once use packet size.
    http://wiki.sdn.sap.com/wiki/display/ABAP/ABAP4TuningChecklist
    Regards,
    Sudha
    Edited by: Sudha Rani Pathuri on Nov 20, 2010 6:42 PM
    Edited by: Sudha Rani Pathuri on Nov 20, 2010 6:48 PM
    Edited by: Sudha Rani Pathuri on Nov 20, 2010 6:51 PM

  • If else logic in select statement

    Hi,
    Can someone kindly explain me how can i use if-else logic in the place of case statement in the below query.
    SELECT deptno, empno, ename, sal,
                 CASE
                    WHEN deptno = 10
                       THEN sal * 0.05
                    WHEN deptno = 20
                       THEN sal * 0.10
                 END AS new_sal
            FROM emp;Thanks in advance!!

    CREATE OR REPLACE PROCEDURE calsal
    IS
       new_sal number;
       CURSOR sal_cursor
       IS
          SELECT deptno, empno, ename, sal
            FROM emp;
    BEGIN
       FOR i IN sal_cursor
       LOOP
              if i.deptno = 10 then
                   new_sal := i.sal *0.05 ;
               DBMS_OUTPUT.put_line (   ' Salary plus bonus of '
                                || i.empno
                                || ' is '
                                || (new_sal)
           elsif i.deptno = 20 then
                   new_sal := i.sal *0.1 ;
               DBMS_OUTPUT.put_line (   ' Salary plus bonus of '
                                || i.empno
                                || ' is '
                                || (new_sal)
           else
                     new_sal := 0 ;
               DBMS_OUTPUT.put_line (   ' Salary plus bonus of '
                                || i.empno
                                || ' is '
                                || (new_sal)
           end if;
       END LOOP;
    END;
    / Are you learning Oracle or sql or pl/sql ?
    The syntax and example of if in oracle is easily awailable in bunch of documents provided in google search results..
    Regards,
    Dipali..

  • Is there any  way to Mask the Name when  a select statement is issued?

    Dear all,
    Is there any way to mask the name .. i mean if User issue a select statement in a customer table the real name should come like ' ABCXXXDEFXXCFXX'... Which is not the actual name?
    e.g if Name: CHIEV SONG MEE
    If user issue a statment select * from customers;
    The Result Should come something Like this:
    Name
    CHXXV SXNG MXX
    Thank You

    user3029023 wrote:
    but it seems there is no option in oracle it self which can be used as there they are saying to get a data masking software which we can't due to some internal issues....I would not say that. How one implements masking depends entirely on the requirements that need to be met.
    For example, schema A owns all the tables. Schema B can be created as a "trusted" schema - in other words, schema A trusts schema B and allows it full access (with grants) to its tables. Schema B implements data masking as views. For each table in A, a view exists in B that implements the required masking. B can now grant select access on these views to user C. User C will see the same data object names in B as it would have if it used A - only, by using the B data objects it uses masked data objects and not the original source data objects.
    Another example - schema Dev is to have all the data objects of schema Prod, but masked where needed. One can use CTAS (Create Table As Select) to create the required tables in Dev with masked values where relevant. This Dev schema can be "refreshed" on weekends by dropping all tables and getting a new fresh copy of production data and masking it - ready for the next week's development cycle.
    If the application use is for example APEX, then instead of coding SQL directly as reporting regions to display, a function is used instead. APEX supports reporting regions where it calls a function and this function provides the APEX run-time with the SQL to execute and contents to render. It is easy to use this approach to implement logic in functions that masked column data depending on who the APEX user is, the security/role attributes of the user, and so on.
    No there is not a single "+mask this column!+" feature in Oracle.. but that does not mean that such a feature is not supported and cannot be implemented. Oracle has a very comprehensive and rich set of tools - more so than most (if not all) other RDBMS products.
    It is up to the architect/designer/developer to use this toolkit in creating a system that meets the specific requirements at hand.

  • Having Problem in select statement.

    Dear gurus
    im having an issue in select statement.
    i have written a select statement which is fetching the result as i required but it takes to much time to execute.
    how to make it work fast.
    SELECT vbak~vkbur vbap~vbeln vbap~posnr vbak~audat
             vbap~kwmeng vbap~meins vbak~kunnr vbak~vkorg
             vbak~vtweg  vbak~spart matnr matkl auart
             vbap~abgru
      INTO CORRESPONDING FIELDS OF TABLE so_tab
      FROM vbak
      JOIN vbap ON vbak~vbeln = vbap~vbeln
      WHERE audat IN in_date
      AND matnr IN matnr
      AND ( auart = 'ZISO' OR auart = 'ZEXP' )
      AND vbap~werks IN werks  .
      SELECT lips~vbeln lips~posnr likp~lfdat lips~lfimg
             lips~meins likp~kunag matnr vgbel vgpos
             lfart
      INTO CORRESPONDING FIELDS OF TABLE del_tab
      FROM likp
      JOIN lips ON likp~vbeln = lips~vbeln
      FOR ALL entries IN so_tab
      WHERE vgbel = so_tab-vbeln
      AND vgpos = so_tab-posnr
      AND lfdat IN in_date
      AND likp~werks IN werks.
    Regards
    Saad Nisar.

    Hi,
    I agree with sabu.
    Along with these you need to do following things -
    SELECT vbak~vkbur vbap~vbeln vbap~posnr vbak~audat
             vbap~kwmeng vbap~meins vbak~kunnr vbak~vkorg
             vbak~vtweg  vbak~spart matnr matkl auart
             vbap~abgru
      INTO CORRESPONDING FIELDS OF TABLE so_tab
      FROM vbak
      JOIN vbap ON vbak~vbeln = vbap~vbeln
      WHERE audat IN in_date
      AND matnr IN matnr
      AND ( auart = 'ZISO' OR auart = 'ZEXP' )
      AND vbap~werks IN werks  .
    {color:green}
    *if sy-subrc eq 0.*
    *so_tab_tmp[]  = so_tab[].*
    *sort so_tab_tmp by vbeln posnr.*
    *delete adjacent duplicates from so_tab_tmp by vbeln posnr.*
    *if so_tab_tmp[] is not initial.*
    {color:green}
      SELECT lips~vbeln lips~posnr likp~lfdat lips~lfimg
             lips~meins likp~kunag matnr vgbel vgpos
             lfart
      INTO CORRESPONDING FIELDS OF TABLE del_tab
      FROM likp
      JOIN lips ON likp~vbeln = lips~vbeln
      FOR ALL entries IN so_tab_tmp
      WHERE vgbel = so_tab_tmp-vbeln
      AND vgpos = so_tab_tmp-posnr
      AND lfdat IN in_date
      AND likp~werks IN werks.
    {color:green}
    *endif.*
    *endif.*
    {color:green}

  • Select Statement Hangs often

    Hello ,
    I have very strange issue, Any select statement on few tables takes very long time( in fact it hangs) often but the same SQL runs in a second all other times in the same database. Please note that it is a simple select statement without any 'for update' clause.
    After recycling the database, the select statement runs faster but this situation comes back after couple of days on the same set of tables.
    We are using 9i release 2.
    Can you please advise how to go about solving this type of issue.
    Thanks.

    438628, Robert is correct in that the board would need to see an explain plan to have any chance of narrowing the problem down. If bind variable peeking is involved the plan may not match what Oracle is actually doing to solve the query.
    When the problem occurs try looking in v$plan_table and see if the plan matches the explain plan output. A difference would be a clue that a reparse of sometype is being done so the plan could be different for each execution. The presence of child cursors would also point to something causing reparses.
    Do any of the columns for this table involved in the where clause has histograms on them? What is the value of the spfile/init.ora parameter cursor_sharing?
    If cursor_sharing is EXACT then bind variable peeking should not be the problem. If the parameter is SIMILAR or FORCE then it could be. On 9.2 I believe there is a bug that causes a reparse for every execution when SIMILAR is used so evey execution could be a different plan.
    To check for skewed data just count the values in the column and then count by value. If the max(value_count) / count(*) is greater than a small percentage of the data then the column is skewed. The worse the skew the more likely that a plan chosen for a distinctive value is not a good plan for a non-distinctive value.
    HTH -- Mark D Powell --

  • Using if the else logic in regards to a select statement for a report

    Hi all,
    I've a question regarding if then else logic in Oracle.
    I'm developing a report application which contains 3 selectlists
    - ProductGroup - SubGroup - Manufacturer
    Each one containing several values. And are based on eachother, meaning if you select an item from the PG list, you only get the SG items regarding the PG item you've choosen before. The process logic should be as the following:
    When a user selects one item from for example the PG list, the query will be:
    select * from x where PG = :P_PG
    and the report displays all the items in the PG category selected
    The other two bindvariables would be null as the user didn't pick them
    If he then proceeds and selects one item from the SG list, the query would be:
    select * from x where PG = :P_PG and SG = :P_SG
    and the report displays all the items in the PG and SG category selected
    If he then proceeds and selects one item from the MA list, the query would be:
    select * from x where PG = :P_PG and SG = :P_SG and MA =:P_MA
    and the report displays all the items in the PG and SG and MA category selected
    Now, I've read some documentation about the decode function, but I can't figure it out, please help.
    Peter

    Okay, Chet, have set it up on htmldb, so you can see my problem, will go in high detail, it is not producing what I want. Example on htmldb:
    DEMO/test
    http://htmldb.oracle.com/pls/otn/f?p=33229:6
    Defenitions:
    3 LOV's, namely:
    - LOVPG - select distinct productgroep, productgroep pg from plijst
    - LOVSG - select distinct subgroep, subgroep sg from plijst where productgroep = :P6_LOVPG
    - LOVLE- select distinct leverancier, leverancier le from plijst where productgroep = :P6_LOVPG and subgroep = :P6_LOVSG
    3 Selectitems with submit, namely:
    - :P6_LOVPG
    - :P6_LOVSG
    - :P6_LOVLE
    Report region select statement:
    select * from plijst where (productgroep = :P6_LOVPG or :P6_LOVPG IS NULL) and (subgroep = :P6_LOVSG or :P6_LOVSG IS NULL) and (leverancier = :P6_LOVLE or :P6_LOVLE IS NULL)
    Branch to:
    Branche to page on submit after processing
    What it should do is:
    When you select an item from the first selectlist, productgroep, the report should show all rows containing the specified productgroep.
    When the user selects the next item in the subgroep selectlist, the report should show all rows containing the previously selected prodctgroup and the just selected subgroep.
    When the user selects the final item , the report should show all rows based on all three selected itemvalues, productgroep, subgroep, leverancier.
    The problem is that with this setup the report is only generated after the final selectlist choice of the user. But the user should see a report before that, going deeper into the structure. Hope, you see my problem?
    Sincerely,
    Pete

  • Issue with Select options in select statement - ABAP Question

    Hi
    I am facing an issue with select options. Select statement is returning sy-subrc as 4.
    I wrote the program as below:
    SELECT-OPTIONS:
    s_kunnr FOR bsad-kunnr,
    s_lifnr FOR bsak-lifnr,
    s_gjahr FOR bsad-gjahr,
    s_bukrs FOR bsad-bukrs,
    s_saknr FOR bsad-saknr,
    s_budat FOR bsak-budat.
    In start of selection I have written the select statement as
    SELECT * FROM bsak INTO TABLE lt_bsak
    WHERE bukrs IN s_bukrs AND lifnr = s_lifnr AND gjahr IN s_gjahr AND budat IN s_budat AND saknr IN s_saknr.
    In selection screen I have not entered any values and executed the program. I am not getting any result. When I debug that, sy-subrc is 4 at above select statement. But table has records.
    If am removing the "lifnr = s_lifnr " condition in select then select is returning values.
    I am not getting where I made the mistake. Please suggest.
    Thank you
    Hanu

    Hi,
    The problem here with where condition select option lifnr = s_lifnr.
    Use below select query.
    SELECT * FROM bsak INTO TABLE lt_bsak
    WHERE bukrs IN s_bukrs
        AND lifnr     IN s_lifnr
        AND gjahr   IN s_gjahr
        AND budat  IN s_budat
        AND saknr  IN s_saknr.
    s_lifnr is a select option and you are passing it as parameter lifnr = s_lifnr.
    if you want to pass this s_lifnr as single vale then pass in below mentioned way.
    lifnr = s_lifnr-low
    BR,
    Vijay

  • Selected state issue with Menu Module V2

    OK so I am getting an issue with Menu Module V2. I have used this before with success but this time I have hit a wall. I possed this question to BC live chat and they bugged out real quick.
    The site in construction is http://www.urbanista.com.au
    What is happening is that in the top right tools nav with the headings Home, Services, People, Contact Us using Menu Module V2. The Heading Services has a drop down and this is where the issue resides. Roll over any of these nav devices and you will see they will highlight orange. Home is already auto activating its Selcted state. Click on Contact Us and it will do the same.  Roll over and click on Services and it appears to have worked. While in Services roll over the drop down again and you will see all links have activated the Selected state. This is the issue. If you view the code of the Services UL you will see only the Services state has been alocated the Slected state. See below:
    <li id="Services" class="selected">
    <a href="/services.htm">Services</a>
    <ul>
    <li id="tools-panningdev">
    <li id="tools-housing">
    <li id="tools-urban-renewal">
    <li id="tools-project-management">
    <li id="tools-feasibility-tools">
    <li id="tools-governance-systems">
    <li id="tools-communications">
    <li id="tools-projects">
    </ul>
    </li>
    The CSS that runs the nav is as follows:
    ul.dropdown {
        font-weight: normal;
        font-family: Arial, Helvetica, sans-serif;
        font-style: normal;
        text-decoration: none;
        ul.dropdown li {
        background-color: transparent;
        color: #999;
        padding-top: 5px;
        padding-right: 10px;
        padding-bottom: 5px;
        padding-left: 10px;
        font-size: 12px;
        ul.dropdown li.hover,
        ul.dropdown li:hover {
        background-color: transparent;
        color: #FFF;
        ul.dropdown a:link,
        ul.dropdown a:visited    {
        color: #FFF;
        text-decoration: none;
        ul.dropdown a:hover        { color: #ff871f; }
        ul.dropdown a:active    {
        color: #b33b00;
        /* -- level mark -- */
        ul.dropdown ul {
        width: 150px;
        margin-top: 1px;
        background-image: url(/images/nav-transparency.png);
        background-repeat: repeat;
        color: #FFF;
        ul.dropdown ul li {
        font-weight: normal;
    ul.dropdown li.selected a {
        color: #ff871f;
    The last entry 'ul.dropdown li.selected a {color: #ff871f;}' is required in order to allocate a Slected State. Without it not Selected state is active and the links al remian white.
    I have tried all manner of combinations and additonal tags with no success. Any suggestions greatly appreciated. I have not modified the default Javascript provided by BC in the system apart from allocating the required ulTagClass as specified. The Javascript in the supplied 'container.html' is as follows:
    <script type="text/javascript" >
        // ids need to be unique per page, use different ones if you are including multiple menus in the same page
        // id of the nav tag, used above
        var divTagId = "myMenu1";
        // desired id for 1st <ul> tag
        var ulTagId = "myMenu1List";
        // desired class for 1st <ul> tag
        var ulTagClass = "dropdown dropdown-vertical";
        if ((null !== ulTagId) && ("" !== ulTagId)) {
            document.getElementById(divTagId).getElementsByTagName("ul")[0].setAttribute("id",ulTagId );
        if ((null !== ulTagClass) && ("" !== ulTagClass)) {
            document.getElementById(divTagId).getElementsByTagName("ul")[0].className = ulTagClass;
        // this will set the selected state
        if ((null !== ulTagId) && ("" !== ulTagId)) {
            catSetSelectedCSSItem(ulTagId);
    </script>
    Lastly this is one of the recomended navs by BC at the following address: http://lwis.net/free-css-drop-down-menu/
    I have used these before with success but for the life of me this has stumped me big time.

    Hi Matthew,
    Having a super quick look at the code I'd say it's because of:
    ul.dropdown li.selected a {
        color: #ff871f;
    This affects all the child elements.
    To override this down the line you could do something like:
    ul.dropdown li.selected ul li a {
        color: #fff;
    This would override the parent link color when selected.
    You could probably then also add:
    ul.dropdown li.selected ul li.selected a {
        color: #ff871f;
    For the dropdown selected states.
    That's a quick look though so don't quote me too much

  • Select statement issue- urgent pls help

    Hi
    The following select statement is always  failed, even LIKP table has data. pls help me
      LOOP AT LT_VBRP.
        IF LV_KEEP_VGBEL <> LT_VBRP-VGBEL.
          LV_KEEP_VGBEL = LT_VBRP-VGBEL.
          CLEAR LIKP.
          SELECT single  VBELN TRAID TRATY VERUR BOLNR LFDAT
          FROM LIKP INTO
          (LIKP-VBELN,LIKP-TRAID,LIKP-TRATY,LIKP-VERUR,LIKP-BOLNR,LIKP-LFDAT)
            WHERE BOLNR = LT_VBRP-VGBEL.
          IF SY-SUBRC = 0.
            LV_ASN_FOUND = 'X'.
          ELSE.
            CLEAR LV_ASN_FOUND.
          ENDIF.
        ENDIF.
        MOVE-CORRESPONDING LT_VBRP TO LT_LIPOV.
        IF LV_ASN_FOUND = 'X'.
          LT_LIPOV-VBELN    = LIKP-VBELN.             "ASN #
          LT_LIPOV-LFDAT    = LIKP-LFDAT.
         lt_lipov-verur    = likp-verur.
          LT_LIPOV-BOLNR    = LIKP-BOLNR.             "DDL#
          LT_LIPOV-KOMAU    = LIKP-VBELN.
    get the ASN line number details.
          SELECT VBELN POSNR MATNR ERDAT LFIMG ERNAM WERKS VGBEL VGPOS FROM LIPS INTO
          TABLE LT_LIPOV
           WHERE VBELN = LIKP-VBELN.
        ELSE.
          CLEAR LT_REP-VBELN.
          CLEAR LT_REP-LFDAT.
          CLEAR LT_REP-VERUR.
          CLEAR LT_REP-BOLNR.
          LT_REP-KOMAU = LT_VBRP-VBELN.             "Inv no
          LV_MESSAGE = TEXT-504.
          PERFORM CREATE_REPORT_RECORD_LIN01.
          LT_REP-LINE_COLOUR = 'C610'.  " red Intensified
        ENDIF.
        APPEND LT_REP.
        APPEND LT_LIPOV.
        CLEAR LT_LIPOV.
        CLEAR LT_REP.
      ENDLOOP.

    Hi Kumar....
    if statement should not be like ..
    if lv_keep_vgbel lt_vbrp-vgbel.
    Should be like this  if lv_keep_vgbel = lt_vbrp-vgbel.
    and try to use work area and table to select and loop the data...
    Have YOu checked whether da data in it_vbrp...
    there few error in way You are writing...
    And one more thing in the table LIKP the field BOLNR is 35 Char and VGBEL of VBRP is 10 char ...and your are equalling that to extract the data which will not happen even..
    So before select statement change VBRP-VGBEL as 35 char varible by using like this
    data : v_vgbel type likp-bolnr.
    loop at lt_vbrp.
    if lv_keep_vgbel lt_vbrp-vgbel. " Why did you right the statement like this
        if lv_keep_vgbel = lt_vbrp-vgbel.
            clear likp.
                call function 'CONVERSION_EXIT_ALPHA_INPUT'
                  exporting
                    input  = lt_vbrp-vgbel
                  importing
                    output = v_vgbel.
                  select single vbeln traid traty verur bolnr lfdat
                                                      from likp into
                                                     (likp-vbeln,likp-traid,likp-traty,likp-verur,likp-bolnr,likp-lfdat)
                                                      where bolnr = v-vgbel.
    regards,
    sg
    Edited by: Suneel Kumar Gopisetty on May 26, 2008 4:41 AM

  • Stop auditing select statements issued against SYS objects

    Hi,
    My current client has a requirement to track destructive updates (i.e. insert, update, delete) issued by users who can connect directly to the database. At the moment though, SELECT statements issued against SYS-owned objects are also being captured to the Oracle audit trail. For the time being at least these need to be disabled.
    I've issued NOAUDIT SELECT TABLE/SEQUENCE and NOAUDIT SELECT ANY TABLE/SEQUENCE commands, as has a user with the SYSDBA privilege, and they're still being logged. Is there any way to switch these off? I don't know if it's significant (I'm not a DBA by trade) but the audit_sys_operations parameter is set to True.
    My client is currently running Oracle Database 10.2.0.5.0 standard edition.
    If anyone has any suggestions I'd be grateful.
    Thanks in advance,
    Steve

    Hi,
    Thanks for the input so far ...
    @Eduardo and KarK ...
    show parameter audit
    audit_file_dest string D:\ORACLE\PRODUCT\10.2.0\ADMIN\USSUPM2\ADUMP
    audit_sys_operations boolean TRUE
    audit_trail string DB, EXTENDED
    If we set audit_sys_operations to FALSE, won't that stop auditing of all actions carried out by, for example, someone who connects as SYSDBA? That is something that's still needed to be captured. Unfortunately they go to the WIndows Event Log but at least they're captured somewhere.
    @Hemant
    This auditing was in place before my client took me on, so I can't say what was used to initiate it unfortunately. What I can say though is that they absolutely don't want to turn off auditing by SYS- type users, just SELECT against SYS-owned objects.
    Thinking simplistically, could I just write a script which trawls dba_objects for sys-owned tables, views and sequences and explicitly issues a noaudit select against what's found, and get one of the sysdba-type people we have access to to run it?
    Thanks in advance (again)
    Steve

  • What happen while issuing select statement

    hi,
    Can any one please explain what happen while we are issuing select statement in instance ?
    please give me info.
    thanks,
    Sanjeev.

    Please read Overview of SQL Processing in http://download.oracle.com/docs/cd/E11882_01/server.112/e16508/sqllangu.htm#CHDFCAGA

Maybe you are looking for