Two If statments

Hi Gurus,
Please check below conditon here two if statements are there
if a>b then Result = c - d
if c<=d then Result = 0
How to write if statement in Query designer
Regards,
Ram

Hi Srini,
Thanks for your reply,
I have written following condition., it is showing only boolean values in Result row 0's and 1's but it should show actual values.
(if ( (if a>b)*(c-d) ) > 0) gives value C - D if C > D.
Kindly advise,
Regards,
Ram

Similar Messages

  • Help needed in getting the previous Quarter Data

    Hello folks,
    I have this procedure where i have to modify the current procedure in the following manner:
    I need to get rid of the variables p_start and p_end so that i cannot see them in the crystal report and include the Frequency in the procedure to get the Data based on the Dates.
    and Main requirement is" If the Frequency is Quarterly " it should get the previous quarter Data, if "Frequency is monthly" it should return the previous month data.Can anyone please let me know where shud i make changes. Am including the procedure for refernce. Any help is appreciated
    Thanks a millioin,
    CREATE OR REPLACE PROCEDURE hcsc_recovery_report_h(report_record in out cr_return_types.gen_cursor,
    p_start       string,
    p_end         string)
    IS
    v_startdate date;
    v_enddate date;
    BEGIN
    v_startdate := to_date(p_start, 'YYYY/MM');
    v_enddate := last_day(to_date(p_end, 'YYYY/MM'));
    open report_record for
    select --distinct r.recovery_id
    r.event_id,
    r.event_case_id,
    c.client_id,
    c.client_code,
    c.client_name,
    b.branch_group_code,
    b.branch_group_description,
    g.employer_group_code,
    g.employer_group_name,
    e.client_policy_identifier,
    e.date_of_incident,
    e.event_type_code,
    sum(nvl(r.amount, 0)) as amt_received,
    nvl(sum(case
    when r.amount >= 0 then
    rd.fees
    else
    rd.fees * (-1)
    end),
    0) as fees,
    ec.close_date, *001* commented
    (case
    when ec.close_date <= to_date(to_char(v_enddate, 'MMDDRRRR') || '235959',
    'MMDDRRRR HH24MISS') then
    ec.close_date
    else
    null
    end) as close_date, --*001*  added
    get_case_value(ec.event_id, ec.event_case_id, v_enddate) as case_value,
    nvl(etl.fee_percent_flag, 'N') workmans_comp,
    max(to_char(r.recovery_date, 'FMMonthYYYY')) Year_Month,
    max(to_char(r.recovery_date, 'YYYYMM')) Y_M,
    max(to_date(to_char(r.recovery_date, 'MMYYYY'), 'MM/YYYY')) date_MY
    from recovery r,
    recovery_detail rd,
    event e,
    client c,
    branch_group b,
    employer_group g,
    event_case ec,
    event_type_lookup etl
    where r.event_id = e.event_id
    and r.event_case_id = ec.event_case_id
    and ec.event_id = e.event_id
    and rd.recovery_id(+) = r.recovery_id
    and r.recovery_date between v_startdate and
    to_date(to_char(v_enddate, 'MMDDRRRR') || '235959',
    'MMDDRRRR HH24MISS')
    and e.client_id = c.client_id
    and g.client_id = c.client_id
    and b.client_id = c.client_id
    and g.employer_group_id(+) = e.employer_group_id
    and b.branch_group_id(+) = g.branch_group_id
    and e.event_type_code = etl.event_type_code -- SST 130852 04/14/09
    group by r.event_id,
    r.event_case_id,
    c.client_id,
    c.client_code,
    c.client_name,
    b.branch_group_code,
    b.branch_group_description,
    g.employer_group_code,
    g.employer_group_name,
    e.client_policy_identifier,
    e.date_of_incident,
    e.event_type_code,
    ec.close_date,
    get_case_value(ec.event_id, ec.event_case_id, v_enddate),
    nvl(etl.fee_percent_flag, 'N')
    having sum(nvl(r.amount, 0)) <> 0
    order by c.client_code,
    b.branch_group_code,
    g.employer_group_code,
    r.event_case_id;
    Edited by: user11961230 on Oct 20, 2009 9:02 AM

    user11961230 wrote:
    1. I want to get rid of the p_start and p_end. So how do i declare the v_startdate and v_enddate in the following part?
    v_startdate := to_date(p_start, 'YYYY/MM');
    v_enddate := last_day(to_date(p_end, 'YYYY/MM'));I'm not sure what you mean by "declare".
    In PL/SQL, "declare" means state (at the beginning of a block) that there will be a certain variable with a certain name (such as v_startdate) and datatype (such as DATE). You're already declaring the variables v_startdate and v_enddate correctly, right before the BEGIN statement.
    Declaring a variable is not the same as initializing it, that is, giving it a value for the first time. Your next question seems to be about initializing..
    2. where exactly shud i include the logic that u have mentioned. sorry a dumb questionIn place of the two assignment statments that reference p_start and p_end.
    3. This time am gonna use frequency instead of report_type so that i will get rid of the p_start and p_end from the procedure.Do you mean you want to pass an argument (called frequency) that tells if you want a quarterly or a mionthly report, just like the variable report_type in my example?
    If so, replace report_type in my example with frequency.
    I think you want something like this:
    CREATE OR REPLACE PROCEDURE hcsc_recovery_report_h
    (      report_record         in out     cr_return_types.gen_cursor
    ,      frequency         IN           VARCHAR2
    IS
         -- Declare local variables:
         v_startdate     date;
         v_enddate      date;
    BEGIN
         -- Initialize v_startdate and v_enddate, depending on frequency
         IF  frequency = 'QUARTERLY'
         THEN
              v_startdate := TRUNC ( ADD_MONTHS (SYSDATE, -3)
                                           , 'Q'
              v_enddate := TRUNC (SYSDATE, 'Q');
         ELSIF  frequency = 'MONTHLY'
         THEN
              v_startdate := TRUNC ( ADD_MONTHS (SYSDATE, -1)
                             , 'MM'
              v_enddate := TRUNC (SYSDATE, 'MM');
         END IF;
         --   Subtract one second from v_enddate
              v_enddate := v_enddate - ( 1
                                            / (24 * 60 * 60)
         open report_record for
         select --distinct r.recovery_id
                r.event_id,
         and     r.recovery_date  BETWEEN  v_startdate     
                         AND       v_enddate
         ...When you post formatted text on this site (and code should always be formatted), type these 6 characters:
    (small letters only, inside curly brackets) before and after sections of formatted text, to preserve spacing.
    Edited by: Frank Kulash on Oct 20, 2009 2:37 PM
    Changed query to use BETWEEN                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • ** To put Exceptional Branch in loop in BPM

    Hi friends,
    We have a scenario like SO, Delivery, Billing creation based on Purchase Order data. We designed this using BPM. Its working fine. We throw an alert whenever the error is happend in creating document.
    We put control step to throw alert in exceptional branch. So, when the BPM has error in particular step like SO / Delivery/ Invoice, we throw alert. Then the user correct the error and restart the BPM, it will work fine.
    But, after restart again the error is coming in same step, we want to throw alert. So, how do we set exceptional branch in loop ? ie. whenever restart the message, it should check whether any error is there again in the message, if it is there, it should throw alert again.
    Kindly tell me, friend. How do we set this in loop ?
    Kind Regards,
    Jeg P.

    can you be a bit clear
    " We put control step to throw alert in exceptional branch. So, when the BPM has error in particular step like SO / Delivery/ Invoice, we throw alert. Then the user correct the error and *restart the BPM, it will work fine.*
    But, after restart again the error is coming in same step, we want to throw alert. So, how do we set exceptional branch in loop ? ie. whenever restart the message, it should check whether any error is there again in the message, if it is there, it should throw alert again "
    your question has two contradicting statments.  can you be a clear in when you are receiving the error ? try using transactional behaviour .
    Edited by: Pramod Yadav on Jun 10, 2008 2:03 AM

  • Drag and Drop Ap

    I am doing a quick modification of an application that allows you to drag a Div around and drop in onto a target,
    I am trying to get the different Divs to change to different colours when dropped on the target, I have a list of If's that check to see which box has been picked up and which colour to change it to when it is put down on the target. e.g. :
    if(numericIdTarget+numericIdSource==101){sourceObj.style.backgroundColor='#9F4332';}
    if(numericIdTarget+numericIdSource==102){sourceObj.style.backgroundColor='#9G4332';}
    if(numericIdTarget+numericIdSource==103){sourceObj.style.backgroundColor='#9D4332';}
    However only the last 'If' statement appears to function and the program ignores all the other Ifs and thus not changing the Divs colour when it is dropped on the target.
    Is there a quick fix for this
    Thanks a lot
    James

    ironside82 wrote:
    I'm asking what is making it skip past the first two if statments?It's skipping past them because the boolean conditions in the if () part are false.

  • Full outer join

    CREATE TABLE FEE_BANDS_AUD1
        AUDIT_DATE TIMESTAMP (6) NOT NULL ENABLE,
        AUDIT_ACTION          VARCHAR2(30 BYTE) NOT NULL ENABLE,
        AUDIT_USER            VARCHAR2(8 BYTE) NOT NULL ENABLE,
        FEE_BANDS_ID          NUMBER NOT NULL ENABLE,
        FEE_RULE              VARCHAR2(10 BYTE) NOT NULL ENABLE,
        FEE_BAND_LOWER_LIMIT  NUMBER(19,0),
        FEE_BAND_HIGHER_LIMIT NUMBER(19,0),
        RATE_PERCENT          NUMBER(11,4),
        RATE_NUMBER           NUMBER(21,2),
        CAL_BASED_ON          CHAR(1 BYTE) NOT NULL ENABLE,
        REC_SEQ               NUMBER(5,0) NOT NULL ENABLE)
        FEE_BANDS_AUD
    INSERT INTO FEE_BANDS_AUD1 VALUES('18-10-10 06:31:56.625000000 AM','CREATE','sdn',1,'NSK',0,9999999999999999999,11,0,'B',0);
    INSERT INTO FEE_BANDS_AUD1 VALUES('18-10-10 06:53:08.659000000 AM','UPDATE','sdn',1,'NSK',0,100,11,0,'B',1);
    INSERT INTO FEE_BANDS_AUD1 VALUES('18-10-10 06:53:08.659000000 AM','UPDATE','sdn',2,'NSK',101,9999999999999999999,1,0,'B',1);
    INSERT INTO FEE_BANDS_AUD1 VALUES('18-10-10 06:54:51.354000000 AM','UPDATE','sdn',1,'NSK',0,100,11,0,'B',2);
    INSERT INTO FEE_BANDS_AUD1 VALUES('18-10-10 06:54:51.354000000 AM','UPDATE','sdn',2,'NSK',101,9999999999999999999,33,0,'B',2);
    INSERT INTO FEE_BANDS_AUD1 VALUES('18-10-10 07:15:16.354000000 AM','UPDATE','sdn',1,'NSK',0,100,11,0,'B',3);
    INSERT INTO FEE_BANDS_AUD1 VALUES('18-10-10 07:15:16.354000000 AM','UPDATE','sdn',2,'NSK',101,200,33,0,'B',3);
    INSERT INTO FEE_BANDS_AUD1 VALUES('18-10-10 07:15:16.354000000 AM','UPDATE','sdn',3,'NSK',201,9999999999999999999,1,0,'B',3);
    INSERT INTO FEE_BANDS_AUD1 VALUES('18-10-10 07:15:53.341000000 AM','UPDATE','sdn',1,'NSK',0,100,11,0,'B',4);
    INSERT INTO FEE_BANDS_AUD1 VALUES('18-10-10 07:15:53.341000000 AM','UPDATE','sdn',2,'NSK',101,200,33,0,'B',4);
    INSERT INTO FEE_BANDS_AUD1 VALUES('18-10-10 07:15:53.341000000 AM','UPDATE','sdn',3,'NSK',201,9999999999999999999,2,0,'B',4);     
    INSERT INTO FEE_BANDS_AUD1 VALUES('18-10-10 07:18:52.118000000 AM','UPDATE','sdn',1,'NSK',0,100,11,0,'B',5);
    INSERT INTO FEE_BANDS_AUD1 VALUES('18-10-10 07:18:52.118000000 AM','UPDATE','sdn',2,'NSK',101,9999999999999999999,2,0,'B',5);     I have a bandId, in which i will update a new band or delete a band. Each time when i insert,update or delete rec_seq is incremented to one to identify the old set of bands and new set of bands.
    My problem here is when i deleted a band (which is last two insert statments from the above) those are not coming in the old values . It should come in the old value set and new value should come as null.
    I am using full outer join because when i create a new record there wont be any old values in this case old values should come as null and also i delete any values there wont be any new value for that so new should come as null
    This is the query im trying
    select
    O.REC_SEQ,O.audit_action,O.fee_bands_id, O.FEE_RULE,
    O.FEE_BAND_LOWER_LIMIT, O.FEE_BAND_HIGHER_LIMIT,O.CAL_BASED_ON,
    N.REC_SEQ,n.audit_action,n.fee_bands_id, N.FEE_RULE,
    N.FEE_BAND_LOWER_LIMIT, N.FEE_BAND_HIGHER_LIMIT,N.CAL_BASED_ON
    from fee_bands_aud1 O FULL OUTER JOIN fee_bands_aud1 N
    on (N.fee_bands_id = O.fee_bands_id
    and N.FEE_RULE = O.FEE_RULE
    and O.REC_SEQ = N.REC_SEQ-1)
    where N.FEE_RULE = 'NSK'
    order by N.REC_SEQ, n.fee_bands_idwhat is the problem anybody please help i am very new to oracle.

    Yes, it's possible.
    Search for "full outer join" in the online manuals
    http://tahiti.oracle.com/pls/db92/db92.drilldown?levelnum=2&toplevel=a96540&method=FULL&chapters=0&book=&wildcards=1&preference=&expand_all=&verb=&word=full+outer+join+#a96540
    In the SQL Reference you can find an example

  • Joining a ref cursor to a table

    Dear all;
    Can you please show me a simple example on how to join a ref cursor to a table because I have a function that returns a ref cursor and I would like to call that function in another function(function B) and then join it to a table in that function(function B)

    user13328581 wrote:
    well, I personnally know it is a bad idea but my fellow senior keeps advicing me to do it. Their reason is based on the code reusability aspect of things. I had a function 1 already created which returned a ref cursor and basically within that function is a complex select statement. Now I have function 2 which is making use of a similar select statement, the only different between the two select statment is based on the fact, the function 2 select statement is joining to another table at the very end, so based on their argument they want me to call that select statement from function 1 and join it to that table instead...Then your "+seniors+" need to extract their heads from whatever dark orifice they have it stuck in, as this is not how '"+code reusability+" works in the Oracle environment.
    In the SQL language, views are used to create re-usable SQL source code.
    In Oracle, the Shared Pool is used to create and store cursors for reuse (assuming the SQL source allows reusability and uses bind variables).
    Joining a ref cursor (code) with a table (data) is just plain stupid - and no amount of "code reusability" arguing will change this fact.

  • For Update Query

    Hi All,
    I having block level 8000 records, I Scroll down from First record to last record it is takeing more time.
    I Observed tkproof while scrolling two select statments are running..
    1) pre-query block level
    2) For update query
    For update query -> How is is forming? Any Property or some else?
    I am not able to find the second query..where it is forming..How to restrict the second query.
    Query Array size - 10
    Number of records buffered - 10
    Number of records Displayed - 10
    Query all records - No
    Locking mode - Immediate
    Key mode - Automatic
    Version - Oracle 10g
    Plz ........any

    The for update -query is generaetd by forms when its locking the record. If you didn't change anything in the record "by hand", check if there is some code in the POST-QUERY-trigger which forces the record to be locked. if its the POST-QUERY you can issue the following command to avoid the lock at the end of the POST-QUERY:
    SET_RECORD_PROPERTY(:SYSTEM.TRIGGER_BLOCK, :SYSTEM.TRIGGER_RECORD, STATUS, QUERY_STATUS);

  • Trouble Creating Users Via Web Form

    I'm having trouble creating user in a 9i database via web front end.
    I use the following sql to create the user
    strSQL="CREATE USER"""+strUser+"""PROFILE ""DEFAULT"" IDENTIFIED BY ""HELLO"" DEFAULT TABLESPACE ""DATA"" TEMPORARY TABLESPACE ""TEMP"" ACCOUNT UNLOCK"
    I then execute another two sql statments to grant "connect" thus
    strSQL="GRANT ""CONNECT"" TO "+strUser+""""
    strSQL="ALTER USER """ strUser"""DEFAULT ROLE ALL"
    Whenever I try connecting using the new users details, but get an error message that the server had problems accessing the LDAP directory service(ORA-28030).
    I'm happy that the SQL is correect as I created the account that I wanted using Enterprise Console and coppied the SQL it produced. I'm assuming that there's something in the background that is not being triggered when creating the user via the web front end.
    Can anyone tell me where I'm going wrong?
    Thanks
    Jason

    My apologies, I didn't realise HTML DB was a product. I thought it was a forum for questions regarding HTML and databases.
    Doh!!!
    Jason

  • ORA-01000 maximum open cursors exceeded - help!

    Hi, I need some help with resolving ORA-01000 maximum cursors exceeded issue.I know this issue has been discussed before. I know this is caused because of not closing the resultset and statement, connection objects at the right place.
    Can anyone guide me where I should close them?. should they be closed inside the while(rs.next()) loop? There are two prepared statments. I am sure closing in finally block is not enough.
    It would help if you show me by typing the code for closing rs , ps, rs2, ps2, and conn .. should conn be closed too? if yes where..
    Connection conn = null;
    PreparedStatement ps = null;
    PreparedStatement ps2 = null;
    ResultSet rs = null;
    ResultSet rs2 = null;
    ArrayList arrayList = new ArrayList();
    displayerDO pdo = null;
    DocTypeDO dtdo = null;
    StringBuffer sql = new StringBuffer();
    sql.append("SELECT displayer_id, name FROM tech_displayers ORDER BY name");
    StringBuffer sql2 = new StringBuffer();
    sql2.append(" SELECT D.doc_type_id, D.name" +
    " FROM tech_DOC_TYPES D, tech_DOC_TYPE_displayERS P" +
    " WHERE D.default_displayer_id = P.displayer_id" +
    " AND P.displayer_id = ?");
    if(VERBOSE)
    Debug.displayln("displayingControllerDAOORCL.getdisplayers(): sql = " + sql.toString());
    Debug.displayln("displayingControllerDAOORCL.getdisplayers(): sql2 = " + sql2.toString());
    try
    conn = DbUtil.getConnection("tech");
    ps = conn.prepareStatement(sql.toString());
    ps2 = conn.prepareStatement(sql2.toString());
    rs = ps.executeQuery();
    while(rs.next())
    pdo = new displayerDO();
    pdo.setdisplayerId(rs.getInt("displayer_id"));
    pdo.setName(rs.getString("name"));
    ps2.setInt(1, rs.getInt("displayer_id"));
    rs2 = ps2.executeQuery();
    while(rs2.next())
    dtdo = new DocTypeDO();
    dtdo.setDocTypeId(rs2.getInt("doc_type_id"));
    dtdo.setName(rs2.getString("name"));
    // get displayer name from FIRST result set
    dtdo.setdisplayer(rs.getString("name"));
    pdo.addDocType(dtdo);
    arrayList.add(pdo);
    catch(SQLException sqle)
    if(VERBOSE)
    Debug.displayln("displayingControllerDAOORCL.getDocdisplayers(): exception e=" + sqle);
    throw sqle;
    finally
    DbUtil.close(rs2);
    DbUtil.close(ps2);
    DbUtil.close(ps, rs, conn);
    Thanks,
    scott

    Scott,
    From the code it looks like for every row of "ps" you are executing "ps2".
    You should close ps2 as soon as it is done.
    ie.,
    <pre>
    while(rs.next())
    pdo = ...
    rs2 = ps2.executeQuery()
    while (rs2.next())
    }// end of while(rs2.next())
    rs2.close(); // NEW LINE: Close the resultset here.
    }// end of while(rs.next())
    HTH
    Ashok

  • Why this simple code doesn't work?????

    i get error "java.sql.SQLException: Operation not allowed after ResultSet closed "
    try{
                Class.forName("com.mysql.jdbc.Driver");
                Connection dbcon = DriverManager.getConnection("jdbc:mysql://localhost:3306/db?user=user&password=pasw&useUnicode=true&characterEncoding=utf-8");
                String query = "SELECT * FROM  data where parent_id='xxsds^1'";
                Statement statement = dbcon.createStatement();
                ResultSet rs = statement.executeQuery(query);
                while(rs.next())
                    String name = rs.getString("name");
                    String query2 = "SELECT * FROM  data where parent_id='"+name+"'";
                    statement.execute(query2);
                    ResultSet rs2 = statement.getResultSet();
                    while(rs2.next())
                        String name1 = rs2.getString("name");
            catch(Exception ex){out.println(ex);}thanks a lot

    You need to use two separate statments if you're going to interleave the queries like that. I'd think you could get by with a single query and a join though, but I didn't actually look at what your queries are doing.
    Also, you should use PreparedStatement, a "?" parameter, and PS's setString method, rather than a plain old Statement where you have to maually handle string quoting.

  • PrintWriter() issue

    Hi. I'm trying to write a version of HTCPCP for a university assignment and am having a really basic problem with my PrintWriter object server side.
    I have to include a brew() and a get() method. My brew() method simply returns a String telling the client that they must wait 6.2 seconds for the coffee to brew. I just chose an arbitrary value.
    Then I want to call my get() method, 6.2 seconds after my brew() method and return a String to the client telling them to come and get their coffee because it's ready.
    The problem is that the PrintWriter that I'm using seems to close if I use a println() statement to return the brew() method, so the get() method never gets called. However, if I use a print() statement, the program waits for 6.2seconds THEN calls the brew() and get() one after the other instantly. I've put the wait time within the get() method intially but tried putting in the main method and it still happens.
    Any help would be greatly appreciated as I've spent a day trying to sort this out and have got nowhere.
    Section of main():
    PrintWriter out = null;
            BufferedReader in = null;
            try {
                out = new PrintWriter(clientSocket.getOutputStream(), true);
                in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
                input = in.readLine();
                if (checkPropFind(input) == true)
                    out.println(propfind());
                else {
                    checkAdditions(checkAddress(input));
                out.print(brew());
                out.print(get());
                out.close();
            } catch (IOException e) {
                System.out.println(e);
            }brew():
    public static String brew() {
            return "You're drink will now brew for 6.2 seconds to ensure it is perfect.\n";
        }get():
    public static String get() {
            try {
                Thread.sleep(6200);
            } catch (InterruptedException e) {
                System.out.println(e);
                System.exit(1);
            return "\tYou're coffee is ready for collection.\n" +
                    "\tThank you for using the MyCoffee Browser.\n " +
                    "\tThe program will now exit.\n";
        }

    The thing about print streams is they're buffered, and won't always send the data imediately.
    Try out.flush(); between the two print statments. Always use flush if you require data to be sent immediately.
    BTW always use e.printStackTrace() in your general purpose catch clauses, you'll get far more data from exceptions.

  • Equivalence of two statment  at point of view sharing in shared pool

    Hello !
    Please explain,
    by what quantity of symbols hash-funtion defined what two statment is
    equivalent (at point of view sharing in shared pool)
    Best regards,
    Paul

    Hi,
    If i understood your question correctly, you want to know when two or more statements share same cursor( in library cache). The reasons if it can use following
    1) statement is prefectly identical.
    2) Use same optimizer env
    3) Use same user id who executes the statement
    4) Use same session parameters
    5) Use same bind datatype
    6) Use same bind data length
    7) Have same OPTIMIZER_MODE
    8) If cursor is not purged.
    Further reasons can be found in V$SQL_SHARED_CURSOR, that why cursor was not shared.
    Hope this Helps

  • Diffrence in two statment with statement contains only

    hi
    i need to know the difference between two statment as below in ecc
    1) for eg var1 CO '  345678910'
    2) and var1 CO '345678910'
    note the space in first statement as
    regards
    Arora

    the prolem is that in earler system the condition n is true as space is there
    for eg var1 = '109323223' and its working
    but in new system the space is not there hence the sy-subrc = 4 and the check is failed
    pls suggest the implication of removing space in new system
    regards
    Arora

  • Exception in two places of insert statment

    Hi All,
    I want to insert exception in two places in pl sql. I am getting the error.Is there a way to implement exception in two places in insert statement.
    Thanks,
    uday
    Begin
    Declare
    V_Code Number;
    V_Errm Varchar2(64);
    V_Code1 Number;
    V_Errm1 Varchar2(64);
    INSERT INTO Raise
    Select Employee_Id, Salary*1.1 From Employees
    Where Commission_Pct > .2;
    EXCEPTION
    When Others Then
    V_Code := Sqlcode;
    V_Errm := Substr(Sqlerrm, 1, 64);
    Dbms_Output.Put_Line ('Error code ' || V_Code || ': ' || V_Errm);
    Insert Into Scap_Fact_Loading_Errors Values (V_Code, V_Errm, Systimestamp);
    INSERT INTO Raise
    Select Employee_Id, Salary*1.1 From Employees
    Where Commission_Pct > .1;
    EXCEPTION
    When Others Then V_Code1 := Sqlcode;
    V_Errm1 := Substr(Sqlerrm, 1, 64);
    Dbms_Output.Put_Line ('Error code ' || V_Code1 || ': ' || V_Errm1);
    INSERT INTO Scap_Fact_Loading_Errors VALUES (v_code1, v_errm1, SYSTIMESTAMP);
    END;
    Edited by: 929521 on Jan 7, 2013 10:15 AM

    >
    I want to insert exception in two places in pl sql. I am getting the error.Is there a way to implement exception in two places in insert statement.
    >
    Sure - use two different blocks. The code you posted doesn't have any BEGIN.
    The proper structure is:
    BEGIN
    . . . put your first code here
    EXCEPTION
    . . . put your first exception handling here
    END;
    BEGIN
    . . . put your second code here
    EXCEPTION
    . . . put your second exception handling here
    END;If you need your code to quit after an exception in one of the blocks issue a RAISE in the exception handler for that block.
    Depending on what each block does and what you want to save or rollback it is also common to use SAVEPOINTs for the blocks.
    See SAVEPOINT in the SQL Language doc.
    http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_10001.htm
    >
    savepoint
    Specify the name of the savepoint to be created.
    Savepoint names must be distinct within a given transaction. If you create a second savepoint with the same identifier as an earlier savepoint, then the earlier savepoint is erased. After a savepoint has been created, you can either continue processing, commit your work, roll back the entire transaction, or roll back to the savepoint.
    Example
    Creating Savepoints: Example To update the salary for Banda and Greene in the sample table hr.employees, check that the total department salary does not exceed 314,000, then reenter the salary for Greene:
    UPDATE employees
    SET salary = 7000
    WHERE last_name = 'Banda';
    SAVEPOINT banda_sal;
    UPDATE employees
    SET salary = 12000
    WHERE last_name = 'Greene';
    SAVEPOINT greene_sal;
    SELECT SUM(salary) FROM employees;
    ROLLBACK TO SAVEPOINT banda_sal;
    UPDATE employees
    SET salary = 11000
    WHERE last_name = 'Greene';
    COMMIT;
    >
    For your use case you could create a SAVEPOINT before each of the blocks and then in the exception handlers issue a ROLLBACK to the appropriate SAVEPOINT before you exit the procedure.

  • How to give two values of same field in read Statment

    Hi,
    Please Tell me how to give the two values of same field in read statements Condition.
    i.e
      Read table it_tab with key matnr = '1' or matnr = '2'.
    With Regards
    Kesavaperumal

    Hi Kesavaperumal,
    <li>You can not use OR operator with READ TABLE statement.
    <li>You have to use different fields of the internal table in where condition.
    <li>If you want to compare with two values, you need to use LOOP statement.
    LOOP AT it_mara WHERE matnr = '1' or matnr = '2'.
    "Write code
    ENDLOOP.
    Thanks
    Venkat.O

Maybe you are looking for

  • How do I ZIP compress existing TIFF tiles in Lightroom 3?

    I have imported about 1000 .tif files into Lightroom and done some cropping and basic editing to them. They are 8bit uncompressed tiff files in Adobe1998 color space. I am trying to find a way to compress the original tiff files with ZIP compression

  • Urgent: Calling a WebLogic document type Web Service

    We have created an one-way, document type web service that works fine with the clientgen client. When sending the same SOAP message to the service from another client, it fails with: javax.xml.soap.SOAPException: failed to receive message: The other

  • Yosemite upgrade hassles

    MacBook Pro 15-retina...computer crashes all the time, and suddenly now my magic mouse doesn't want to work either after upgrade to Yosemite

  • Will not update itunes

    I added more music to my i tunes and it exceeded the space left on my i pod mini. So I chose the option to have a random i pod "selection". Then I went to update it and it deleted the play lists I created so I went back to my library and unchecked so

  • My program will attempt to open then say it has a problem and shut down

    I have Photoshop Elements 12 and has worked fine for a while.... now when I open it it will attempt to open then windows gives me an error... says it is attempting to resolve the issue and then says it cant and BAM it closes....  I need my photoshop