Home » SQL & PL/SQL » SQL & PL/SQL » PLSQl Help (Oracle 10g)
PLSQl Help [message #391996] Sun, 15 March 2009 20:06 Go to next message
pkumar_2008
Messages: 19
Registered: November 2008
Location: usa
Junior Member

I have to write pl/sql code to generate below output from the Emp Data.

Can Anyone suggest me how to build the code in PLSQL


EMP

EMPno ENAME SAL DEPTNO COMM HIREDATE

1 abc 0.00 10 0 03/13/08
2 bbc 0.00 10 0 03/13/08
3 cbc 0.00 20 0 03/13/08
4 dbc 0.00 20 0 03/13/08
5 ebc 0.00 10 0 03/13/08

Output

EMPNO ENAME DEPTNO SEQ
1 abc 10 1
2 bbc 10 2
5 ebc 10 3
3 cbc 20 1
4 dbc 20 2

Re: PLSQl Help [message #391997 is a reply to message #391996] Sun, 15 March 2009 20:16 Go to previous messageGo to next message
BlackSwan
Messages: 25046
Registered: January 2009
Location: SoCal
Senior Member
You need to help us by following the Posting Guidelines as stated below.
http://www.orafaq.com/forum/t/88153/0/
Re: PLSQl Help [message #391998 is a reply to message #391996] Sun, 15 March 2009 20:59 Go to previous messageGo to next message
Barbara Boehmer
Messages: 8635
Registered: November 2002
Location: California, USA
Senior Member
Check out the ROW_NUMBER analytic function to get your "seq" value.
Re: PLSQl Help [message #392004 is a reply to message #391996] Sun, 15 March 2009 23:29 Go to previous messageGo to next message
ashoka_bl
Messages: 398
Registered: November 2006
Location: Bangalore
Senior Member

Hi,

Why do you need a PL/SQL for this, this can be done in pure SQL

Regards,
Ashoka BL
Re: PLSQl Help [message #392023 is a reply to message #392004] Mon, 16 March 2009 01:26 Go to previous message
Littlefoot
Messages: 20900
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
ashoka_bl
Why do you need a PL/SQL for this, this can be done in pure SQL

Perhaps because students have to learn how to code in PL/SQL, and this was just another task?
Previous Topic: error when excuting procedure
Next Topic: Maximum Date Data Type Size
Goto Forum:
  


Current Time: Thu Dec 08 08:05:44 CST 2016

Total time taken to generate the page: 0.13629 seconds