Can I use case statements in triggers?

I created this trigger, it works BUT I don't like those parentheses at the begining, I would like
to change those parentheses for case statements, well that is my question, can you use case statements in triggers, how you would translate the following in case statement?
FOR EACH ROW
WHEN ( (new.sgbstdn_levl_code = 'UG')
and
( (NEW. SGBSTDN_STST_CODE NOT IN ('GR','SA','AS','IS') )
OR
( (NEW. SGBSTDN_STST_CODE = 'IS' ) AND
(NEW. SGBSTDN_STYP_CODE IN ('N' , 'T' )) AND
(OLD. SGBSTDN_STST_CODE = 'AS' ) ) ) )
==================================================================================================
CREATE OR REPLACE TRIGGER CC_STUD_WITHDRAWAL
AFTER UPDATE OR INSERT ON SATURN . SGBSTDN
FOR EACH ROW
WHEN ( (new.sgbstdn_levl_code = 'UG')
and
( (NEW. SGBSTDN_STST_CODE NOT IN ('GR','SA','AS','IS') )
OR
( (NEW. SGBSTDN_STST_CODE = 'IS' ) AND
(NEW. SGBSTDN_STYP_CODE IN ('N' , 'T' )) AND
(OLD. SGBSTDN_STST_CODE = 'AS' ) ) ) )
DECLARE
v_params gokparm.t_parameterlist;
event_code gtveqnm.gtveqnm_code%TYPE;
firstname spriden.spriden_first_name%TYPE;
lastname spriden.spriden_last_name%TYPE;
middlename spriden.spriden_mi%TYPE;
id spriden.spriden_id%TYPE;
CURSOR get_stud_name IS
SELECT
spriden_id ,
spriden_last_name ,
spriden_first_name ,
spriden_mi
FROM
saturn.spriden
WHERE spriden_pidm = :NEW.SGBSTDN_PIDM
AND spriden_change_ind IS NULL;
BEGIN
IF goksyst . f_isSystemLinkEnabled ( 'WORKFLOW' ) THEN
event_code := SUBSTR ( gokevnt.F_CheckEvent ( 'WORKFLOW' ,'CC_STUDENT_WITHDRAW' ),1,20);
OPEN get_stud_name ;
FETCH get_stud_name INTO id , lastname , firstname , middlename ;
CLOSE get_stud_name ;
----pass parameters to the event
v_params ( 1 ).param_value := 'CC_STUDENT_WITHDRAW' ;
v_params ( 2 ).param_value := '' ;
v_params ( 3 ).param_value := 'Student Withdrawal:' || lastname || ',' || firstname || ' ' ||
middlename ;
v_params ( 4 ).param_value := :NEW.sgbstdn_pidm ;
v_params ( 5 ).param_value := id ;
v_params ( 6 ).param_value := lastname ;
v_params ( 7 ).param_value := firstname ;
v_params ( 8 ).param_value := middlename ;
v_params ( 9 ).param_value := :NEW.sgbstdn_term_code_eff ;
v_params ( 10 ).param_value := :NEW.SGBSTDN_STST_CODE ;
v_params ( 11 ).param_value := :NEW.SGBSTDN_STYP_CODE ;
gokparm.Send_Param_List ( event_code , v_Params );
END IF;
END;
/

You could delete a fair number of extraneous parentheses.
CREATE OR REPLACE TRIGGER cc_stud_withdrawal
  AFTER UPDATE OR INSERT
  ON saturn.sgbstdn
  FOR EACH ROW
  WHEN     NEW.sgbstdn_levl_code = 'UG'
       AND (   NEW.sgbstdn_stst_code NOT IN ('GR', 'SA', 'AS', 'IS')
            OR (    NEW.sgbstdn_stst_code = 'IS'
                AND NEW.sgbstdn_styp_code IN ('N', 'T')
                AND OLD.sgbstdn_stst_code = 'AS'))

Similar Messages

  • Using Case statement instead of IF in formula fields

    Hi,
    Can I use Case statement instead of IF in formula fields?If yes,please specify the syntax.
    regards,
    sunitha

    Hi Sunitha,
    You can surely use case statement instead of the If statement. The syntax for the case statement is :
    Select [1 To n]
      Case "Condition a", "Condition b":
               "c"
      Case "Condition d","Condition e":
                "f"
      Default:
    Hope this helps you!
    Regards,
    Anindita

  • How do we use if statement in labview?moreover can i use if statement inside for loop?

    how do we use if statement in labview?moreover can i use if statement inside for loop?

    The if statement in LabVIEW is the Case structure. You can find that on the Structures palette right next to the For Loop. If you're still on the same subject about terminating a for loop early, then what you do is enclose your functions inside the loop with a case statment and make one of the case's empty except for one or more constants that you might have to wire. Hopefully, the attached picture will explain what I mean. Also, as I mentioned in one of your other posts, I think this technique is not as good as using a while loop. The array in the attached example is the same size no matter what and you may have to handle stripping extra or invalid elements.
    Attachments:
    For_Loop_with_Case.jpg ‏21 KB

  • Can we use Perform statement in start routine ,Form and endform.

    Hi,
    Can we use Perform statement in start routine ? Then write the ABAP code between Form and Endform.
    Example : Can I use Perform ABC in start routine. Then define ABC at the end of start routine.
          Form ABC,
          ......<ABAP> code .....
          Endform.

    Hi,
    In BI 7.0 we have start routines defined using Class where you might be able to create your own performs, but in case of BW3.5 Start routines are defined using Form so there I don't think it will allow you to create one more form.
    But you can surely try both the approaches.
    Reards,
    Durgesh.

  • Need help in this sql query to use Case Statement

    hi All,
    I have the below query -
    SELECT DISTINCT OFFC.PROV_ID
    ,OFFC.WK_DAY
    ,CASE
    WHEN OFFC.WK_DAY ='MONDAY' THEN 1
    WHEN OFFC.WK_DAY ='TUESDAY' THEN 2
    WHEN OFFC.WK_DAY ='WEDNESDAY' THEN 3
    WHEN OFFC.WK_DAY ='THURSDAY' THEN 4
    WHEN OFFC.WK_DAY ='FRIDAY' THEN 5
    WHEN OFFC.WK_DAY ='SATURDAY' THEN 6
    WHEN OFFC.WK_DAY ='SUNDAY' THEN 7
    END AS DOW
    ,OFFC.OFFC_OPENG_TIME
    ,OFFC.OFFC_CLSNG_TIME
    FROM GGDD.PROV_OFFC_HR OFFC
    WHERE OFFC.PROV_ID='0000600'
    WITH UR;
    this query is bringing results in 6 differnt rows with opening and closing time for each day separately. I want to generate the data in one row with each day having opening and closing time, so for 7 days, total 14 columns with opening and closing time. But i am not able to do that using case statement.
    can somebody help me in achieving that.
    thanks,
    iamhere

    Hi,
    Welcome to the forum!
    That's called a Pivot .
    Instead of having 1CASE expression, have 14, one for the opening and one for the closing time each day, and do GROUP BY to combine them onto one row.
    SELECT       OFFC.PROV_ID
    ,       MIN (CASE WHEN OFFC.WK_DAY ='MONDAY'    THEN OFFC.OFFC_OPENG_TIME END)     AS mon_opn
    ,       MIN (CASE WHEN OFFC.WK_DAY ='MONDAY'    THEN OFFC.OFFC_CLSNG_TIME END)     AS mon_cls
    ,       MIN (CASE WHEN OFFC.WK_DAY ='TUESDAY'   THEN OFFC.OFFC_OPENG_TIME END)     AS tue_opn
    ,       MIN (CASE WHEN OFFC.WK_DAY ='TUESDAY'   THEN OFFC.OFFC_CLSNG_TIME END)     AS tue_cls
    FROM        GGDD.PROV_OFFC_HR OFFC
    WHERE       OFFC.PROV_ID     = '0000600'
    GROUP BY  offc.prov_id
    ;This assumes there is (at most) only one row in the table for each distinct prov_id and weekday. If not, what do you want to do? Post a little sample data (CREATE TABLE and INSERT statements) and the results you want from that data.
    The staement above works in Oracle 8.1 and up, but there's a better way (SELECT ... PIVOT) available in Oracle 11. What version are you using? (It's always a good idea to include this when you post a question.)
    Edited by: Frank Kulash on Jan 6, 2011 8:22 PM

  • Can we use Case in Where Clause along with Exists

    Hi Everybody,
    Can we use Case in the where clause with exists? As i have a requirement in which i have to check whether value exists in 6 views, now depending on some value(gns_type )of select clause i have to attach a paticular exists else the performance dies.
    Please go through the query any suggestion appreciated.
    Thanks
    SELECT count(*)
    FROM
    (SELECT eah.changed_date,
    decode(eua.is_deleted, 'N', decode(eah.alert_type, NULL, 'GN', 'R', 'GAR', 'G', 'GAG', 'Y', 'GAY'), 'Y', decode(eah.alert_type, 'R', 'GDR', 'G', 'GDG', 'Y', 'GDY', NULL, 'GN'), NULL, 'GN') AS
    alert_type,
    decode(eac.pta_line, 'N', '') ptaline,
    eac.exp_type_desc,
    eac.supplier_name,
    eac.transaction_id,
    eah.gns_type,
    eac.po_amount,
    eac.po_end_date,
    eah.notes,
    eua.is_deleted,
    eac.expenditure_type,
    eua.gns_alert_summary_id,
    eah.changed_date alert_date,
    eua.user_alert_id,
    eah.reference_number,
    decode(eac.cms_pta_line,'N','',eac.cms_pta_line) cms_pta_line,
    cms_po_amount,
    cms_po_end_date,
    mgns.is_decommitted,
    eac.gns_alert_id,
    eah.gns_type source_name
    FROM xxdl.xxdl_sc_gns_alerts_summary eah,
    xxdl.xxdl_sc_gns_detail_alerts eac,
    xxdl.xxdl_sc_gns_user_alerts eua,
    xxdl.xxdl_sc_manage_gns_master mgns
    WHERE eah.gns_alert_summary_id = eac.gns_alert_summary_id
    AND eah.gns_alert_summary_id = eua.gns_alert_summary_id
    AND eah.transaction_id = eac.transaction_id
    AND eah.transaction_id = mgns.transaction_id)
    a
    WHERE(EXISTS
    (SELECT 1
    FROM xxdl_sc_mng_gns_pta_req_hc_v x
    WHERE x.transaction_id = a.transaction_id
    AND x.source_name = a.source_name
    AND x.project_id = 69309
    AND x.task_id = 242528
    AND x.award_id = 34694)
    OR
    EXISTS( SELECT 1
    FROM xxdl_sc_mng_gns_pta_inv_hc_v x
    WHERE x.transaction_id = a.transaction_id
    AND x.source_name = a.source_name
    AND x.project_id = 69309
    AND x.task_id = 242528
    AND x.award_id = 34694)
    OR
    EXISTS(SELECT 1
    FROM xxdl_sc_mng_gns_pta_req_sc_v x
    WHERE x.transaction_id = a.transaction_id
    AND x.source_name = a.source_name
    AND x.project_id = 69309
    AND x.task_id = 242528
    AND x.award_id = 34694)
    OR
    EXISTS(SELECT 1
    FROM xxdl_sc_mng_gns_pta_inv_sc_v x
    WHERE x.transaction_id = a.transaction_id
    AND x.source_name = a.source_name
    AND x.project_id = 69309
    AND x.task_id = 242528
    AND x.award_id = 34694)
    OR
    EXISTS( SELECT 1
    FROM xxdl_sc_mng_gns_pta_po_sc_v x
    WHERE x.transaction_id = a.transaction_id
    AND x.source_name = a.source_name
    AND x.project_id = 69309
    AND x.task_id = 242528
    AND x.award_id = 34694)
    OR
    EXISTS (SELECT 1
    FROM xxdl_sc_mng_gns_pta_po_hc_v x
    WHERE x.transaction_id = a.transaction_id
    AND x.source_name = a.source_name
    AND x.project_id = 69309
    AND x.task_id = 242528
    AND x.award_id = 34694)
    AND TRUNC(alert_date) >= TRUNC(add_months(sysdate, -1))
    AND TRUNC(alert_date) <= TRUNC(sysdate)
    AND is_deleted = 'N'
    ORDER BY changed_date DESC

    you can do
    WHERE
    CASE WHEN (something) THEN
      CASE WHEN EXISTS (SELECT * from ...) THEN 1 ELSE 0 END
               WHEN (something else) THEN
         CASE WHEN EXISTS (SELECT * from ...) THEN 1 ELSE 0 END      
    END = 1Looking at your current query, it looks like all those exist statements could be a lot neater, maybe like:
    WHERE (69309,242528,34694) IN
    (SELECT project_id,task_id,award_id FROM
      (Select project_id,task_id,award_id,transaction_id,source_name
      FROM
      xxdl_sc_mng_gns_pta_req_hc_v
      UNION ALL
      Select project_id,task_id,award_id
      xxdl_sc_mng_gns_pta_inv_hc_v
      ...) x
    where a.transaction_id = x.transaction_id
    and a.source_name = x.source_name
    )or put the tuple in the where clause at the bottom

  • Using case statement in merge when matched

    Hi,
    I want to use case statement in the when matched clause of merge statement to ensure that I update only those fields that are undated.
    create table TEST1
    NAME1 VARCHAR2(25),
    NAME2 VARCHAR2(25),
    ID NUMBER not null
    create table TEST2
    ID NUMBER not null,
    ID2 NUMBER not null,
    NAME1 VARCHAR2(25),
    NAME2 VARCHAR2(25)
    merge into test1 t1
    using
    test2 t2
    ON (t1.id = t2.id)
    when matched
    then
    case
    when t1.name1 != t2.name1
    then
    update set t1.name1 != t2.name1
    when t1.name2 != t2.name2
    then
    update set t1.name2 != t2.name2
    else
    null;
    end
    it does not work and raises invalid sql command. Any idea how can I do that?
    Thanks.
    Sajid
    Edited by: 808255 on Nov 12, 2010 4:22 AM

    Hi
    In that case you would have to use multiple statements and you may as well just use UPDATE instead of MERGE. Also, are you sure that you aren't trying to to fix a problem that doesn't actually exist.
    Think about where the execution time is going to come from...
    I would be tempted to do 1 UPDATE like this...
       UPDATE test1 t1
       SET    (t1.name1,
               t1.name2) = (SELECT  t2.name1,
                                    t2.name2
                            FROM    test2 t2
                            WHERE  t1.id = t2.id
                            AND   (t1.name1 != t2.name1
                             OR    t1.name2 != t2.name2))If you get specific performance issue with this, then post an explain plan and trace and I'll have a look.
    I don't this the cost of the update is going to be as great as you think.
    Cheers
    Ben

  • How to use CASE statement in WDA

    Hi All,
       Can any one Please expain me ' How to use CASE statement in Web dynpro ABAP? '
      Please give me an example also.
    Thanks in Advance !

    Hi,
    The usage of case statement in webdynpro is same as used in general ABAP.
    Data: l_id type string.
    l_id = wdevent->get_string( 'ID' ).
    case l_id.
    when 'BTN1'.
    when 'BTN2'.
    when 'OTHERS'.
    endcase.
    Regards,
    Radhika.

  • Sql proposed to use case statement

    Hi All
    Can anyone help me here
    This code works fine,here inthe inner sub queries(b,c,d,e,f),i am getting the weekly counts of usage data from the table mf_wer_OBI_USAGE_reqq.
    As this is hitting same table with the similar set of queries so i was adviced to use case statement by taking the wk_1...5 in variable and making the query better
    I am unable to figure out how to proceed.
    Appreciate your help here.
    Thanks
    create table mf_wer_OBI_USAGE_reqq_WK
    as select x.user_name id,x.mon MONTH_COUNT,x.wk_1 WEEK1_COUNT,x.wk_2 WEEK2_COUNT,x.wk_3 WEEK3_COUNT,x.wk_4 WEEK4_COUNT,x.wk_5 WEEK5_COUNT,x.subject_area_name,
    y.EMP_FIRST_NAME FIRSTNAME,y.EMP_LAST_NAME SURNAME,y.E_MAIL_ADDRESS USER_MAILID,y.ouc OUC
    from (select a.user_name,a.mon,a.subject_area_name,b.wk_1,c.wk_2,d.wk_3,e.wk_4,f.wk_5
    from (select user_name,sum(count_us_st) mon,subject_area_name from mf_wer_OBI_USAGE_reqq group by user_name,subject_area_name) a,
    (select user_name,sum(count_us_st) wk_1,subject_area_name from mf_wer_OBI_USAGE_reqq where extract(day from start_dt) between 1 and 7
    group by user_name,subject_area_name) b,
    (select user_name,sum(count_us_st) wk_2,subject_area_name from mf_wer_OBI_USAGE_reqq where extract(day from start_dt) between 8 and 14
    group by user_name,subject_area_name) c,
    (select user_name,sum(count_us_st) wk_3,subject_area_name from mf_wer_OBI_USAGE_reqq where extract(day from start_dt) between 15 and 21
    group by user_name,subject_area_name) d,
    (select user_name,sum(count_us_st) wk_4,subject_area_name from mf_wer_OBI_USAGE_reqq where extract(day from start_dt) between 22 and 28
    group by user_name,subject_area_name) e,
    (select user_name,sum(count_us_st) wk_5,subject_area_name from mf_wer_OBI_USAGE_reqq where extract(day from start_dt) between 29 and 31
    group by user_name,subject_area_name) f
    where a.user_name=b.user_name(+)
    and a.subject_area_name=b.subject_area_name(+)
    and a.user_name=c.user_name(+)
    and a.subject_area_name=c.subject_area_name(+)
    and a.user_name=d.user_name(+)
    and a.subject_area_name=d.subject_area_name(+)
    and a.user_name=e.user_name(+)
    and a.subject_area_name=e.subject_area_name(+)
    and a.user_name=f.user_name(+)
    and a.subject_area_name=f.subject_area_name(+)) x,
    dm_employee y
    where x.user_name=y.id and
    y.active_flg='Y';

    Swas_fly wrote:
    This code works fineIf it's fine, why try to fix it?
    Post your table (only the relevant columns as a CREATE TABLE statement) and some sample data (INSERT into) and your required output.
    Post your code between these tags:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

  • Conditional Filters using case statements

    Hello,
    I have a table view which displays Total Quota and Theatre Quota. Against the Total Quota, there are 2 values - Rollover Revenue and Theatre Revenue. Against the Theatre Quota, there is only Theatre Revenue.
    What I want to accomplish is to display only the Rollover Revenue Aggregated Quarterly number whenever there is a Total Quota number and not display the Theatre Revenue number
    In the table view,
    Year Name     Quarter Name     Quarter Name Sort     Person Region     Quota Name     Quarterly Quota     Credit Amount     QTD Attainment     Credit Type Name
    YEAR-2012     QTR-1-2012     QTR-1-2012     750     Total Quota     6,128,500     5,492,081     89.62%     Rollover Revenue Aggregated Quarterly
                   750          6,128,500     5,344,000     87.20%     Theatre Revenue
         QTR-2-2012     QTR-2-2012     750     Total Quota     5,922,500     5,890,264     99.46%     Rollover Revenue Aggregated Quarterly
                   750          5,922,500     6,120,000     103.33%     Theatre Revenue
         QTR-3-2012     QTR-3-2012     750     Total Quota     5,716,500     0     0.00%     
         QTR-4-2012     QTR-4-2012     750     Total Quota     5,510,500     0     0.00%     
    I used an example in the following link:
    http://oraclebizint.wordpress.com/2008/02/06/oracle-bi-ee-101332-conditional-filters-using-case-statements-in-filters/
    and applied the example in my scenario:
    CASE WHEN Quota."Quota Name" = 'Total Quota' THEN "Credit Type"."Credit Type Name" ELSE 'Dummy' END != 'Theatre Revenue'
    I still get duplicate rows.
    Thanks.

    Could you suggest any solutions for this problem where I can conditionally hide the number only for a certain type of data and not for all type of data?
    Thanks.

  • Checking for the condition types using case statement

    hi folks,
    I have a lot of condition types that I have to check for and I am using case statement to do that. The code goes like this.
    case wac-kschl.
            when 'ZRAT' OR 'ZAGR' OR 'ZRCR' OR
                  'Y098' OR 'Y007' OR 'ZREW' OR 'Y106'        OR 'ZTSR' OR 'Y127' OR 'Y125' OR 'Y126' OR 'Y124' OR 'Y157' OR 'Y092' OR 'Y085' OR 'Y090' OR 'ZMZD'
    OR 'Y215' OR 'Y214' OR 'Y111' OR 'ZC$D' OR 'ZAUD'.
    up till here it is working on errors and when I add few more condition types to the case statement it is throwing the error.
    I have to check for all the condition types out here.
    How can I correct it? Is there a better way to do it?
    thanks
    Santhosh

    Hi Santhosh,
    I think that your CASE statement has a flaw. The line length of one of the lines is too large. You need to insert a carriage-return to shorten it (or press the button 'Pretty Printer').
    The code would look nicer like this:[code]  CASE wac-kschl.
        WHEN 'ZRAT' OR 'ZAGR' OR 'ZRCR' OR 'Y098' OR 'Y007' OR 'ZREW'
          OR 'Y106' OR 'ZTSR' OR 'Y127' OR 'Y125' OR 'Y126' OR 'Y124'
          OR 'Y157' OR 'Y092' OR 'Y085' OR 'Y090' OR 'ZMZD' OR 'Y215'
          OR 'Y214' OR 'Y111' OR 'ZC$D' OR 'ZAUD' OR 'Z001' OR 'Z002'
          OR 'Z003' OR 'Z004' OR 'Z005' OR 'Z006' OR 'Z007' OR 'Z008'
          OR 'Z009' OR 'Z010' OR 'Z011' OR 'Z012' OR 'Z013' OR 'Z014'.
        Do your thing here
          WRITE: / 'OK'.
        WHEN OTHERS.
          WRITE: / 'NOT OK'.
      ENDCASE.[/code]If this will not work for you, you could try a different approach:[code]* Local definition
      DATA:
        var_list(1024).
    Build variable string for checking
      CONCATENATE 'ZRAT ZAGR ZRCR Y098'
                  'Y007 ZREW Y106 ZTSR'
                  'Y127 Y125 Y126 Y124'
                  'Y157 Y092 Y085 Y090'
                  'ZMZD Y215 Y214 Y111'
                  'ZC$D ZAUD'
             INTO var_list
        SEPARATED BY space.
    Check if the correct value is supplied
      IF var_list CS wac-kschl.
      Do your thing here
        WRITE: / 'OK'.
      ENDIF.[/code]Hope this helps you a bit.
    Regards,
    Rob.

  • Can we use Loop Statement for Ranges

    Hi Friends,
    I have a range say R_Range. I need to loop at each line item and get the values in another range R_New_Range, i have to count the number of items in R_new_range. How is it possible.
    I know range is nothing but an internal table. So we can direcly use Move statements or so ...,
    But my question is .....
    My R_range has values as below
    'I' 'EQ' '001'
    'I' 'EQ' '002'
    'I' 'BT' '003' '007'
    'I' 'EQ' '008'
    I have to move all these values to R_New_range and my count of items should be '8'.
    How can i do that????????
    Expecting ur answers....
    Thanks in advance
    Cheers,
    R.Kripa.

    hey friends,
    Its nice to see the replies.... but i think i had confused u all with the question
    Now i'll explain u all in detail ....
    See i have 15000 projects ( eg., AAA111... ) and 100 GL accounts ( eg., 123443... ) .....
    I have to get the costs from COSS and COSP tables for all the projects - GL account combinations which leads to some 1500000 entries ..... So it is giving me a SQL Dump "DBIF_RSQL_INVALID_RSQL" .........
    Description of the Dump is
    Error in the module RSQL accessing the database interface
    An exception occurred. This exception is dealt with in more detail below
    . The exception, which is assigned to the class 'CX_SY_OPEN_SQL_DB', was
    neither                                                                
    caught nor passed along using a RAISING clause, in the procedure        
    "GET_COSP_COSS" "(FORM)"                                               
    Since the caller of the procedure could not have expected this exception
    to occur, the running program was terminated.                          
    The reason for the exception is:                                        
    The SQL statement generated from the SAP Open SQL Statement violates a  
    restriction imposed by the database system used in R/3.                                                                               
    Possible errors:                                                        
    o The maximum size of an SQL statement has been exceeded.              
    o The statement contains too many input variables.                     
    o The space needed for the input data exceeds the available memory.    
    o ...                                                                               
    You can usually find details in the system log (SM21) and in the        
    developer trace of the work process (ST11).                             
    If an error occurs the developer trace often informs you about the      
    current restrictions.                                                   
    So now i want to fine tune the program so that the execution works perfectly and get me the values for all the data 1500000 :-|
    Now :
    My Projects are stored in the form of a range R_Range
    I have to loop at this range and then process 100 records at a time and then again take other 100 records .... i'll count till 100 records by getting loopaing at the range and for each loop pass i'll increment the counter ....
    I am clear till this .....
    If record consist of 'EQ' option .... then ofcourse we can consider the total record to be 1 record and we can add 1 to counter ......
    But if the record consist of 'BT' option ...... then how can we loop that and get the number of -low numbers in that range and add to my counter ????
    Hope iam clear with my question
    If not do revert back ....
    Thanks in advance for the replies
    Cheers,
    R.Kripa.
    My Doubt is ....

  • Can we use return statement in procedure?

    Can we use return statement in procedure or we can use more than one return statement in procedure?

    HamidHelal wrote:
    NOReally? Did you at least test it? You can use RETURN in procedure or in anonymous PL/SQL block. The only restriction is you can't specify return value:
    SQL> begin
      2      dbms_output.put_line('Before return');
      3      return;
      4      dbms_output.put_line('After return');
      5  end;
      6  /
    Before return
    PL/SQL procedure successfully completed.
    SQL> create or replace
      2    procedure p1
      3      is
      4      begin
      5          dbms_output.put_line('Before return');
      6          return;
      7          dbms_output.put_line('After return');
      8  end;
      9  /
    Procedure created.
    SQL> exec p1;
    Before return
    PL/SQL procedure successfully completed.
    SQL> begin
      2      dbms_output.put_line('Before return');
      3      return 99;
      4          dbms_output.put_line('After return');
      5  end;
      6  /
        return 99;
    ERROR at line 3:
    ORA-06550: line 3, column 5:
    PLS-00372: In a procedure, RETURN statement cannot contain an expression
    ORA-06550: line 3, column 5:
    PL/SQL: Statement ignored
    SQL> create or replace
      2    procedure p1
      3      is
      4      begin
      5          dbms_output.put_line('Before return');
      6          return 99;
      7          dbms_output.put_line('After return');
      8  end;
      9  /
    Warning: Procedure created with compilation errors.
    SQL> show err
    Errors for PROCEDURE P1:
    LINE/COL ERROR
    5/9      PL/SQL: Statement ignored
    5/9      PLS-00372: In a procedure, RETURN statement cannot contain an
             expression
    SQL> SY.

  • Can we write case statement

    Hi,
    Can we write CASE statement in Where clause of select statement...
    I searched on net, i found that case statement can be written in the having clause..
    But how about in the where clause....

    You could have easily tried it.
    sql> with mytab as
      2  (select 1 col1, 'one' col2 from dual
      3  union all
      4  select 2 col1, 'two' col2 from dual
      5  )
      6  select * from mytab
      7  where (case when col1 = 1 then col2
      8             else 'dummy' end) = 'one';
          1 one

  • Query Tuning - using CASE statement in the WHERE clause - Duplicate Post

    Duplicate Post by mistake.
    Please check
    Query Tuning - using CASE statement in the WHERE clause
    Edited by: Chaitanya on Jun 9, 2011 2:45 AM
    Edited by: Chaitanya on Jun 9, 2011 2:46 AM

    Duplicate Post by mistake.
    Please check
    Query Tuning - using CASE statement in the WHERE clause
    Edited by: Chaitanya on Jun 9, 2011 2:45 AM
    Edited by: Chaitanya on Jun 9, 2011 2:46 AM

Maybe you are looking for

  • Slow printing in Acrobat 7/9 on G5

    Here's a really odd problem: I have a G5 with 10.4.11. When I print a PDF which is all B/W images (scans) it takes a long time to queue the job and then there's a significant pause at the printer between each page. It's being printed to a copier conn

  • Oracle 11g release 2 installation error

    Hi, I am facing below error while oracle slient installation. Checking swap space: must be greater than 150 MB. Actual 1498 MB Passed Preparing to launch Oracle Universal Installer from /tmp/OraInstall2011-09-02_12-44-52PM. Please wait ...[oracle@loc

  • How best to send double byte characters as http params

    Hi all I have a web app that accepts text that can be in many languages. I build up a http string and send the text as parameters to another webserver. Hence, whatever text I receive i need to be able to represent on a http query string. The paramete

  • RAW support for Nikon D5000

    I just got a Nikon D5000 but PSE 7.0 cannot load the RAW images. I saw that ACR 5.4 with D5000 support is now available but it does not have the install scripts for PSE 7. Has anyone been able to manually install the data files for the D5000?

  • Enable/Disable Drill-Through Reporting?

    Hi, We have a BSO app which has Drill-through reports (defined in EIS). Reports are working fine. Is there a way to disable/enable drill-through reporting on an App/DB using MAXL? Appreciate your thoughts. Thanks, Ethan.