given an employee number,display the following information to the user:
employee name
employee sectionNo
employee Designation
1 对应vice president
2 对应senior manager
3 对应assistant manageruse the &rowtype declaration for obtaining the employee information from the tables;
如果用decode能做出来吗?

解决方案 »

  1.   

    谁能帮我写一个带decode的Pl/sql语句,解决那个问题呢?
      

  2.   

    [code=SQL][/SELECT NAME,sectionNo,decode(Designation,1,'vice president',2,'senior manager',3,'assistant manager') FROM employee ]
      

  3.   

    SELECT NAME,sectionNo,decode(Designation,1,'vice president',2,'senior manager',3,'assistant manager') FROM employee
      

  4.   

    单独使用decode是不行的.DECLARE 
    n NUMBER;
    BEGIN
    n:=DECODE(1,2,3,4,5);
    END;
    /        n:=DECODE(1,2,3,4,5);
               *
    ERROR at line 4:
    ORA-06550: line 4, column 5:
    PLS-00204: function or pseudo-column 'DECODE' may be used inside a SQL statement only
    ORA-06550: line 4, column 2:
    PL/SQL: Statement ignored
    但是放到select语句里就可以了.DECLARE 
    n NUMBER;
    BEGIN
    SELECT DECODE(1,2,3,4,5)
    INTO n
    FROM dual;
    END;
    /PL/SQL procedure successfully completed.