473,811 Members | 1,788 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

please convert this query to postgresql which is already in oracle

1 New Member
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_NA ME,'---'),
UPPER( DECODE (PAY_MODE,'C',' Cash','D','DD', 'CD','CASH/DD','Q','Chq',' R','Card')),
TOT_AMT,DEPT_SH ORT_DESC,TRAN_S TATUS,NVL(USER_ CHARGES,0),shif t_code,
NVL(DECODE(PAY_ MODE,'R',(NVL(C HQDD_CARD_AMT,0 )-NVL(TOT_AMT,0)-
NVL(USER_CHARGE S,0))),0)
FROM TW_TRANS MST,TW_DEPT_MST , TW_TRANS_PAY_DT LS DTL WHERE
MST.TW_TRAN_NO= DTL.TW_TRAN_NO( +) AND
MST.DEPT_CODE=T W_DEPT_MST.DEPT _CODE
AND MST.TW_TRAN_DAT E =TO_DATE('26-11-2010','dd-mm-yyyy')
AND STAFF_CODE='OPR 237'
AND CENTRE_CODE='AK PM'
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_R CPT_NO,'--'),CONSUMER_NO, COALESCE(CONSUM ER_NAME,'---'),TOT_AMT,DEPT _SHORT_DESC,TRA N_STATUS,COALES CE(USER_CHARGES ,0),shift_code,
coalesce(case when PAY_MODE = 'R' then (coalesce(CHQDD _CARD_AMT,0)-coalesce(TOT_AM T,0)- coalesce(USER_C HARGES,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_MS T, CSC_TRANS_PAY_D TLS DTL WHERE MST.TW_TRAN_NO= DTL.TW_TRAN_NO outer join a on AND MST.DEPT_CODE=C SC_DEPT_MST.DEP T_CODE
AND MST.TW_TRAN_DAT E =TO_DATE('2010-11-26','YYYY-MM-DD') AND STAFF_CODE='OPR 237' AND CENTRE_CODE='AK PM' AND TRAN_STATUS='N' ORDER BY MST.TW_TRAN_NO


Thanks & Regards,

Phani Kumar.
Jan 5 '11 #1
0 89560

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

Similar topics

10
2507
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
1548
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, lintCurrentPage As Integer
4
1470
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, the reporting for that sale (i.e. estimated Gross, Units ect) are split in half. The problem arises when I have to give the other salesman the other half. For reporting purposes, sales are totaled and grouped by salesman on a monthly basis. It...
14
2483
by: sudheerk | last post by:
please give me a query for already existing name in the data base using mysql
2
5366
by: Punkch | last post by:
Hi , Does anyone know how to Export the data from postgresql to oracle ??
2
1894
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 light on the that part. Also how to implement it in the VBA code. SELECT t_activity.no_activity, IIf(="GP","Plan", IIf(="Prov","Appr.",IIf(="Fix","Fix", ))) AS act_steps FROM t_activity_brand, t_customer INNER JOIN t_activity ON ...
2
3574
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 rd@stat2.scn.ru:/usr/src/sys/i386/compile/RDSTAT2-ORACLE i386 uname -a under oracle user : Linux stat2.scn.ru 2.4.2 FreeBSD 5.2.1-RELEASE-p3 #2: Fri Apr 23 19:19:43 KRAST 2004 i686 unknown
0
2727
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 complexity involved. Any help is appreciated. Thanks
1
2843
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 ACT_ACCOUNT.ID_ACCOUNT, ACT_ACCOUNT.CODE_ACCOUNT, ACT_ACCOUNT.NAME_AR, ACT_ACCOUNT.NAME_EN, ACT_ACCOUNT.ACCOUNT_PID, DECODE(ACT.CODE_ACCOUNT,null,0,ACT.CODE_ACCOUNT)as "CODE_PARENT_ACCOUNT", DECODE(ACT.NAME_AR,null,' ',ACT.NAME_AR)as...
0
9728
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10648
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10389
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10402
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9205
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6890
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5554
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3867
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.