Is their way to re-write the if statement

hi want to re-write the IF statemet in following pl/sql block
set serveroutput on
declare
v_empno emp.empno%type:=7839;
v_sal emp.sal%type;
v_mgr emp.mgr%type;
begin
select sal,comm into v_sal,v_mgr from emp where empno=v_empno;
if v_sal is null then
dbms_output.put_line('sal not found');
else
dbms_output.put_line(v_sal);
end if;
if v_mgr is null then
dbms_output.put_line('mgr not found');
else
dbms_output.put_line(v_sal);
end if;
exception
when others then
dbms_output.put_line('empno not found');
end;

If you want to use ELSIF, then you should have three control statement. In your example, you have two. YES or NO
You should change it in this way:
   IF v_sal IS NULL
   THEN
      DBMS_OUTPUT.put_line ('sal not found');
   ELSIF v_sal IS NOT NULL AND v_sal > 1000
   THEN
      DBMS_OUTPUT.put_line ('Salary is more than 1000');
   ELSIF v_sal IS NOT NULL AND v_sal < 1000
   THEN
      DBMS_OUTPUT.put_line ('Salary is less than 1000');
   END IF;- - - - - - - - - - - - - - - - - - - - -
Kamran Agayev A. (10g OCP)
http://kamranagayev.wordpress.com

Similar Messages

  • Is there a way to completely write the  response of a JSP file to another

    Is there a way to completely write the response of a JSP file to another file...? say for example as a new html file..??!!
    Ofcourse, the client side resultant response page of a jsp will be an HTML; so can anybody tell me of a way to do the file wring task?
    i know of one very very lengthy way... using FILE I/O and write each and every HTML tag and dynamic data using Java/JSP... i dont need that..
    any other direct way??

    Yes. u can forword to some other location by using http URL.
    ragards
    DRA

  • How to write the sql statement of my finder function in cmp?

    hi,
    I create a cmp ejb from table INFOCOLUMN,and I create a my finder function ,which sql statement is :
    select * from INFOCOLUMN WHERE employee_id=id
    employee_id is a column of the table,and id is the finder function parameter.
    The error is : invalid column name
    So,how to write the sql statement.
    Thanks .

    Mole-
    Bind variables are of the form $1, $2, etc., so your query stmt should look like:
    select * from INFOCOLUMN WHERE employee_id=$1
    -Jon

  • Can we write the select statement on maintence view for data retreval

    Can we use the select statement on maintence view
    Regrads
    Diva

    No. U cannot write a select on maintenance view.

  • How can i write the following statements in Java ???

    Hi Everyone,
    I'm studying UML and according to my textbook, it says if 2 classes have the following relationship then it can be said that there's an association relationship between those 2 classesl.
    Class A and B are associated if :
    - an object of class A sends a message to an object of class B
    - an object of class A creates an object of class B
    - an object of class A has an attribute whose value are objects of class B or collections of objects of class B
    - an object of class A receives a message with an object of class B as an argument.
    However, I dunno how to write those stuff into Java codes. Can someone please kindly write Java codes for those sentences ?? Thanks everyone in advance.

    Sorry guys. I know I shouldn't have asked in the first place without giving it a try first. Yeah, I been doing
    Java without understanding the concept of real OOP and its terms.
    - an object of class A sends a message to an object of class B // ?????
    - an object of class A creates an object of class B // A obj=new A();
    - an object of class A has an attribute whose value are objects of class B or collections of objects of class B // A varB;
    - an object of class A receives a message with an object of class B as an argument. // ?????
    I get confused with the very first line and the last line . I dunno what it means by sending a message but according to what JoachimSauer mentioned
    it's "calling a method" but does that mean even I called an object of the same class within , can i still refers it as sending a message ?? Like what if
    i call a static method of the calling object because I dun think i create an object when I call a static method ?
    Let's say
    class ExampleOne
         public ExampleOne()
              ExampleOne egOne=new ExampleOne();
              egOne.display(); //can i refer to this as egOne object sending a message to an object of itself so the receiver is also egOne ??
         public void displayOne()
              System.out.println("Just an exampleOne");
    class ExampleTwo
         public ExampleTwo()
              ExampleTwo.display(); // here no object creation occurs , just ExampleTwo class sends a message to itself so there's no association i assume .
         public static void displayTwo()
              System.out.println("Just an exampleTwo");
    public class Main
         public static void main(String args[])
              ExampleOne exampleOne=new ExampleOne();
              ExampleTwo exampleTwo=new ExampleTwo();
    }I'm confused. at first , i thought sending a message means passing values as parameters when we call a function and receiving a message means the function
    being called receive values as parameters. Phew, please help me out of this.

  • Restricting records in the select statement

    Hi,
    I have one requirement where in i need to restrict my select statement to get only 250 records in the output table.
    Here are the select statements i am using....
        SELECT a~ebeln
                     a~lifnr
                     a~ekgrp
                     b~werks
                     b~matnr
               FROM ekko AS a INNER JOIN ekpo AS b
               ON aebeln = bebeln
               INTO TABLE i_ekko
               WHERE a~ebeln IN r_ebeln AND
                            a~lifnr IN r_lifnr AND
                            a~ekgrp IN r_ekgrp AND
                            b~werks IN r_ewerk AND
                            b~matnr IN r_matnr AND
                            a~bstyp = 'F'.
                IF NOT i_ekko[] IS INITIAL.
    Select Vendor name
               SELECT lifnr
                            name1
                      FROM lfa1
                      INTO TABLE i_lfa1
                      FOR ALL ENTRIES IN i_ekko
                      WHERE lifnr = i_ekko-lifnr.      
    Here if i restrict the first select statement to get only 250 records then i am not getting the desired record in the second select statement.
    Could anyone let me know how to write the select statement.
    Regards,
    Ramesh

    restric the first select using up to 250.
    sort the i_ekko by vendor name.
    ex: sort i_ekko by lifnr.
    use second select statement here.

  • Problem in the select statement

    I have to select the values of the fields BEZEI  depending on tha sales order number vbeln. HOw can i write the select statement what will be the tables associated?

    Hi,
    tables: vbak.
    types: begin of ty_vbak,
               vbeln type vbeln,
               kokrs type kokrs,
              end of ty_vbak,
              begin of ty_it_tka01,
                kokrs type kokrs,
                bezei type bezei,
              end of ty_tka01.
    data: it_vbak type table of ty_vbak,
            wa_vbak type ty_vbak,
            it_tka01 type table of ty_tka01,
            wa_tka01 type ty_tka01.
    Select-options: s_vbeln for vbak-vbeln.
    Select VBELN KOKRS from VBAK into table it_VBAK where vbeln in s_vbeln.
    if sy-subrc = 0.
    select KOKRS BEZEI from TKA01 into it_tka01 for all entries in it_vbak where kokrs = it_vbak-kokrs.
    endif.
    Loop at it_vbak into wa_vbak.
    read table it_tka01 into wa_tka01 with key kokrs = wa_vbak-kokrs.
    if sy-subrc = 0.
    * Move data to final internal table.
    endif.
    endloop.
    Regards,
    Satish

  • How to find the select statement has written all selected values into text

    Hi,
    I am using form6i. i am selecting a set of values from database tables based upon some user parameters and writing into the text file using Text_io.put_line . In this case how we can make sure that the text fille contains all the data what we are selected from selected statement. somebody told that there might be chances of aborting of data while writing into the text file. is there any way to fild out the selected statements has written all the selected fields and corresponding output into the .txt file.
    Please suggest me.

    somebody told that there might be chances of aborting of data while writing into the text fileWhat kind of "chance" does that somebody refer to?
    If you want to verify if the number of records (lines) in the file matches the number of records from the cursor, you could re-open the written file in read-mode and count the number of lines by reading one by one, then compare the number of lines with the number of records from the cursor.

  • How to isolate the Sql Statement from Java Code

    Hi
    I Need to know that can we segregate the Sql Statements and convert them to Stored Procedures so as to isolate the Sql statements from Java Code.
    So i have one static web page which uses four select Statements so what i want is to create a stored procedure encapsulating these queries. So that the Java Web Developer will simply call the Stored Procedure instead of using four different SQL Statements.
    Suppose the developer has these four Statements
    Select ename,empno,sal,job from emp;
    select empno,ename,mgr from emp;
    select deptno,dname from dept;
    select emp.ename,emp.empno,emp.deptno,dept,dname fromemp,dept;
    So can i encapsulate these four Sql Statements in one Procedure and the Web developer can call the Store procedure and dont need to write the Sql Statements in his code.
    Can Anybody guide me how to write this Stored type of Store procedure.
    Thanks

    http://www.google.com/search?q=java+windows+registry
    Next time, search yourself. It might be beyond your belief, but you're really, really not the first person to wonder about this.

  • I bought a used iPhone on ebay.  when I try to activate it, I get a message that the owner needs to sign in to the device with their appleID and password.  I have no way of knowing who the owner is.  How can I get around this?

    I bought a used iPhone on ebay.  when I try to activate it, I get a message that the owner needs to sign in to the device with their appleID and password.  I have no way of knowing who the owner is.  How can I get around this?

    Check the eBay listing. Did it state the device was Activation Locked? If not, then make a claim as Meg stated and get a refund. You will not be able to activate the phone and no one can help you contact the owner, unless that is the person that sold the device. If they cannot remove the phone from their account because it is not theirs, then refund is your route. Even Apple cannot assist with locating the previous owner.

  • Using Mac OSX Install Disc 1, I am not able to get any further than the Partition tab.  It allows me to select my hard drive selection, but will not allow me to make any other selections.  Does anyone know their way around this obstacle?  Thanks!

    Using Mac OSX Install Disc 1, I am not able to get any further than the Partition tab.  It allows me to select my hard drive selection, but will not allow me to make any other selections such as options.  Does anyone know their way around this obstacle?  Am I doing anything wrong?  Thanks

    Hello, The Hatter, I read about the 'trick' of backing up, erasing, and restoring too, but I figured it would take longer than defragmenting the disk.
    But the defragmentation process has just finished! so I'm gonna try to run Boot Camp again soon!
    Thanks for your helpfulness, anyway.
    And P.S. I didn't clone my system onto the external drive, I just inserted the Mac OS X Install CD, rebooted holding down the "C" key, and installed a fresh Snow Leopard system onto the predetermined partition. I will use that in cases of emergency, when my main/internal system becomes unusable.

  • At work we have many who travel with train alot, where the internet is very unstable at best. And  they have trouble getting their e-mails. So the question is if there is a way to increase the mail cache in iOS 7, to lower the dependence of internet.

    At work we have many who travel with train alot, where the internet is very unstable at best. And  they have trouble getting their e-mails.
    So the question is if there is a way to increase the mail cache in iOS 7, to lower the dependency of a very poor internet connection.

    I don't think so. Unless it's in the settings, there's not much that can be done.
    are they using wifi on the train? If so, maybe switching to cellular. There are devices like the Mifi, which is a battery operated portable wifi hotspot that they can connect their device to.
    If the wifi on the train is solid, I know I've had issues using certain hotspots. For example, my yahoo mail simply will not pull down via the mail app if I'm on some AT&T hot spots. But if I go in via safari then it works. So if the signal is good, maybe using a different way can help.
    Or maybe looking for a mail interface that isn't apple's. There are others in the app store that may have better function or more control.

  • I bought a iphone 4 on online . But the guy forgot the his apple id pasword and i cant restore the iphone cuz i need the password is their any way i can restore the iphone . ?

    I bought a iphone 4 on online . But the guy forgot the his apple id pasword and i cant restore the iphone cuz i need the password is their any way i can restore the iphone . ??

    iOS 7 has an antitheft feature. A stolen phone can NEVER be used again, except by the original owner or with the authorization of the original owner. If you bought a stolen phone that was your mistake; get your money back. While it's possible that the seller "forgot" their password, that is an easily corrected problem. In most countries knowingly possessing stolen property is a crime. Even if you don't know it is stolen, it can be taken from you and returned to the rightful owner.
    If it really wasn't stolen, and it was an honest mistake on the part of the seller, the seller can easily correct the mistake and authorize your activation of the phone.

  • Write a SELECT statement in different ways is not the same thing!!!

    Let's take a look
    use AdventureWorks2012
    go
    dbcc freeproccache
    go
    and now select something
    select * from [HumanResources].[vEmployeeDepartmentHistory]
    go
    so, analyzing 'Compiled Plan'
    SELECT usecounts, cacheobjtype, objtype, text
    FROM Sys.dm_exec_cached_plans
    CROSS APPLY sys.dm_exec_sql_text(plan_handle)
    where cacheobjtype = 'Compiled Plan'
    ORDER BY usecounts DESC;
    GO
    and now let's write some SELECT in "fuzzy case"
    dbcc freeproccache
    go
    select * from [HUMANResources].[vEmployeeDepartmentHistory]
    go
    select * from [HumanRESOURCES].[vEmployeeDepartmentHistory]
    go
    select * from [HumanResources].[VEmployeeDepartmentHistory]
    go
    select * from [HumanResources].[vEmployeeDEPARTMENTHistory]
    go
    select * from [HumanResources].[vEmployeeDepartmentHISTORY]
    go
    SELECT * from [HumanResources].[vEmployeeDepartmentHistory]
    go
    select * FROM [HumanResources].[vEmployeeDepartmentHistory]
    go
    and now let's see compiled plans again
    SELECT usecounts, cacheobjtype, objtype, text
    FROM Sys.dm_exec_cached_plans
    CROSS APPLY sys.dm_exec_sql_text(plan_handle)
    where cacheobjtype = 'Compiled Plan'
    ORDER BY usecounts DESC;
    GO
    So, write a SELECT statement in different ways is not the same thing!!!
    Hope it'll be useful
    P.Ceglie

    Yes.  There is little or no query normalization that happens in front of the query plan cache.  It would be a performance tradeoff to parse and normalize the query before matching it to the cached plans.  The benefit of reducing the number
    of plans in the cache probably wouldn't be worth it. 
    David
    David http://blogs.msdn.com/b/dbrowne/

  • Cisco 2504 Local radius configuration, is their any ways for backing up the user db? In case the WLC dies

    Cisco 2504 Local radius configuration, is their any ways for backing up the user db?  In case the WLC dies

    Please find the guide to keep the backup:-
    http://www.cisco.com/en/US/partner/docs/wireless/controller/7.0/configuration/guide/c70mfw.html#wp1063850

Maybe you are looking for

  • Ipod empty after connecting to computer

    Connect Ipod classic to computer.....sync happens but no music was transfered to my ipod, infact it took everything off of my ipod and it is now empty. I try to sync individual songs and it seems like its transfering but then my ipod is still empty I

  • Settlement job is held up on JEST table

    Hi , A settlement job is held up in JEST table and is shown in SM66.There are many hits of this JEST table which is in sequential read status .The job which is related to this table is running inconsistently since 3 days ie the duration for completio

  • Help How Do i set up VPN

    Hello everyone I need help setting up a VPN I own my own a post production company and we just purchased final cut server about a year ago. And we're starting to get really busy so I need some editors to access the server from home. How do I set up a

  • How do we make the field's technical name appear in the selection screen

    Hi everyone, When we go into the manage of a target for diplaying the content of the object say active data table of ODS, I can only see the technical name of custom objects( infoobjects) like /bic/zcust but the technical name of the business content

  • I'm a singer wondering if it's possible to change the key to a backing? Eg. a key convertor?

    I'm a singer wondering if it's possible to change the key to a backing (song)?  Eg. A key convertor?