473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

please convert this query to postgresql which is already in oracle

i have a query which is in oracle pls convert and give me in postgresql format.

SELECT MST.TW_TRAN_NO ,NVL(DEPT_RCPT_NO,'--'),CONSUMER_NO,NVL(CONSUMER_NAME,'---'),
UPPER( DECODE (PAY_MODE,'C','Cash','D','DD','CD','CASH/DD','Q','Chq','R','Card')),
TOT_AMT,DEPT_SHORT_DESC,TRAN_STATUS,NVL(USER_CHARG ES,0),shift_code,
NVL(DECODE(PAY_MODE,'R',(NVL(CHQDD_CARD_AMT,0)-NVL(TOT_AMT,0)-
NVL(USER_CHARGES,0))),0)
FROM TW_TRANS MST,TW_DEPT_MST, TW_TRANS_PAY_DTLS DTL WHERE
MST.TW_TRAN_NO=DTL.TW_TRAN_NO(+) AND
MST.DEPT_CODE=TW_DEPT_MST.DEPT_CODE
AND MST.TW_TRAN_DATE =TO_DATE('26-11-2010','dd-mm-yyyy')
AND STAFF_CODE='OPR237'
AND CENTRE_CODE='AKPM'
AND TRAN_STATUS='N' ORDER BY MST.TW_TRAN_N


i tried but the result is not correct in postgresql:

The query i tried is :

SELECT MST.TW_TRAN_NO,COALESCE(DEPT_RCPT_NO,'--'),CONSUMER_NO,COALESCE(CONSUMER_NAME,'---'),TOT_AMT,DEPT_SHORT_DESC,TRAN_STATUS,COALESCE(US ER_CHARGES,0),shift_code,
coalesce(case when PAY_MODE = 'R' then (coalesce(CHQDD_CARD_AMT,0)-coalesce(TOT_AMT,0)- coalesce(USER_CHARGES,0)) end ,0),
UPPER(
CASE WHEN PAY_MODE='C' THEN 'CASH'
WHEN PAY_MODE='D' THEN 'DD'
WHEN PAY_MODE='CD' THEN 'CASH/DD'
WHEN PAY_MODE='Q' THEN 'CHQ'
WHEN PAY_MODE='R' THEN 'CARD'
END)
FROM CSC_TRANS MST,CSC_DEPT_MST, CSC_TRANS_PAY_DTLS DTL WHERE MST.TW_TRAN_NO=DTL.TW_TRAN_NO outer join a on AND MST.DEPT_CODE=CSC_DEPT_MST.DEPT_CODE
AND MST.TW_TRAN_DATE =TO_DATE('2010-11-26','YYYY-MM-DD') AND STAFF_CODE='OPR237' AND CENTRE_CODE='AKPM' AND TRAN_STATUS='N' ORDER BY MST.TW_TRAN_NO


Thanks & Regards,

Phani Kumar.
Jan 5 '11 #1
0 89533

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Buzz | last post by:
Please convert to VB.NET protected override bool ProcessKeyEventArgs(ref Message m) { if((char)m.WParam == '.') m.WParam = (IntPtr)','; return false;
4
by: Karunakararao | last post by:
Hi all Please Convert the VB.Net to C# .NET Sub CustomPager(ByVal STCPagerGrid As Object) Dim intCtr As Integer Static intLastItem As Integer Static intCount As Integer Static intTotalPage,...
4
by: technobob | last post by:
I have what seems to be a strange situation. I have a table where Sales are recorded. Most of the time there is only a primary salesman involved (Salesman1). When there is a secondary salesman,...
14
by: sudheerk | last post by:
please give me a query for already existing name in the data base using mysql
2
by: Punkch | last post by:
Hi , Does anyone know how to Export the data from postgresql to oracle ??
2
by: rahuldev999 | last post by:
Hi Can anyone please convert the below access query to the equivalent stored procedure.No problem with the IIF() function but the condition in the "where" clause making problem.so please put some...
2
by: Ruslan A Dautkhanov | last post by:
Hello ! I'm about to install O9i on FreeBSD box. uname -a: FreeBSD stat2.scn.ru 5.2.1-RELEASE-p3 FreeBSD 5.2.1-RELEASE-p3 #2: Fri Apr 23 19:19:43 KRAST 2004...
0
Saii
by: Saii | last post by:
Hello Can somebody point me to a good document on PostgreSQL to Oracle migration steps. I have checked various sites including postgresql.org but I need to have a basic head start to evaluate the...
1
by: osman7king | last post by:
hello all... I'm trying to convert the query which uses outer join statment from Oracle to PostgreSQL but I have some problems with this query may some one help me for this problem? SELECT ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.