I have an employee table called ID_EMPLOYEE_MASTER
with the fields
EMP_CODE,
EMP_NAME,
EMP_JOIN_DATE,
EMP_STATUS,
EMP_BASIC,
EMP_ACCOUNT,
EMP_BANK
I want to query all the employees whose status is 'P' ie..PRESENT,THEIR BANK ACCOUNT ie.. EMP_ACCOUNT, THEIR BASIC ie EMP_BASIC,THEIR NAME ie.. EMP_NAME, then give a sequence number, then their EMP_CODE
I have tried the following query:
SELECT'01'||TO_CHAR(SYSDATE,'MMYY')||RPAD(EMP_ACCOUNT,16,'0')||
LPAD(EMP_BASIC,18,'0')||RPAD(EMP_NAME,32,'0')||LPAD(ROWNUM,4,'0')||
LPAD(EMP_CODE,10,'0') AS " "
FROM ID_EMPLOYEE_MASTER WHERE EMP_STATUS='P'
AND EMP_BANK='BM_CB' ORDER BY EMP_JOIN_DATE,ROWNUM
I would like the format of the display to be:
0115090023194700084016000000000002112000DILIPKUMARAG00000000000000000000010000000029
The problem is the result doesn't get display properly.
If Dilip Kumar is the oldest employee, his name gets displayed first but his sequence number doesn't get displayed as 0001
but it comes out as 0013
.
The other problem is salary, I would like it to be displayed in OMANI RIALS and some BAISA, which is 3 places after the decimal, but I'm not able to get the DAISA displayed, only RIALS get displayed. The output I get is like the following:
0115090023194700084016000000000000002112DILIPKUMARAG0000000000000000000130000000029
Please help me...:(