473,396 Members | 1,784 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,396 software developers and data experts.

Convert MS Transact-SQL to Oracle SQL

Hello you all,

I have this code that is written in MS Transact-SQL and I need to convert it to work with Oracle. Can anyone please help??? I need the code for a VBscript project.

Thanks!

Here is the code:

======

[code]USE [**********]

-- declare variables
DECLARE @Organization binary(16)
DECLARE @DeliveryRecipient binary(16)
DECLARE @InvoiceRecipient binary(16)
DECLARE @CommMethod binary(16)
DECLARE @MinDate decimal(17,0)
DECLARE @MaxDate decimal(17,0)


-- set the organization guid, please insert the correct code number
SET @Organization = (SELECT [GUID] FROM [ORGANIZATION002] WHERE
Expand|Select|Wrap|Line Numbers
  1.  = '9999999')
  2.  
  3.  
  4. -- set the guid for the partner relation type DeliveryRecipient and Invoicerecipient for further use
  5. SET @DeliveryRecipient = (SELECT [GUID] FROM [PARTNERRELATIONTYPE001] WHERE [NAME] = 'Deliveryrecipient')
  6. SET @InvoiceRecipient = (SELECT [GUID] FROM [PARTNERRELATIONTYPE001] WHERE [NAME] = 'Invoicerecipient')
  7. -- set email as communication method
  8. SET @CommMethod = (SELECT [GUID] FROM [COMMUNICATIONMETHOD] WHERE [NAME] = '300')
  9. -- set minimun and maximum date
  10. SET @MinDate = 11231231000000
  11. SET @MaxDate = 47121230000000000
  12.  
  13.  
  14. SELECT
  15. P.[NUMBER001] CustomerNumber,
  16. P.[NAME] CompanyName,
  17. P.[UPDATEINFOXDELETETIME] DeleteTime,
  18. P.[VALIDFROM] validFrom,
  19. P.[VALIDUNTIL] validUntil,
  20. -- customer address
  21. PA.[STREET] Street,
  22. PA.[POSTALCODE] ZipCode,
  23. PA.[CITY] City,
  24. PAC.[DESCRIPTION] Country,
  25. CD.[COMMDATA] EMail,
  26. -- address of the delivery recipient
  27. DRP.[NUMBER001] DeliveryRecipient,
  28. DRPA.[STREET] Street,
  29. DRPA.[POSTALCODE] ZipCode,
  30. DRPA.[CITY] City,
  31. DRPAC.[DESCRIPTION] Country,
  32. DRCD.[COMMDATA] EMail,
  33. -- address of the invoice recipient
  34. IRP.[NUMBER001] InvoiceRecipient,
  35. IRPA.[STREET] Street,
  36. IRPA.[POSTALCODE] ZipCode,
  37. IRPA.[CITY] City,
  38. IRPAC.[DESCRIPTION] Country,
  39. IRCD.[COMMDATA] EMail,
  40. -- tax number 
  41. PTI.[TAXIDENTIFICATIONNUMBER] taxNumber,
  42. PTI.[LOCALTAXIDENTIFICATIONNUMBER] LocalTaxNumber,
  43. -- =============================================
  44. -- web shop access control
  45. --
  46. C.[FALUWEBSHOPUSER] isUser,
  47. C.[FALUWEBSHOPUSERNAME] Username,
  48. C.[FALUWEBSHOPUSERNAME] Password
  49. -- =============================================
  50. FROM [PARTNER001] P
  51. -- just select partners who are customers for the specified organization
  52. JOIN [ORGANIZATIONALUNITPARTNER] OUP 
  53.     ON  OUP.[GUID] = P.[GUID] 
  54.     AND OUP.[ORGANIZATIONALUNIT] = @Organization
  55. JOIN [CUSTOMER002] C 
  56.     ON  C.[GUID] = P.[GUID] 
  57.     AND C.[ORGANIZATIONALUNIT] = @Organization
  58. LEFT OUTER JOIN [ADDRESSDATA] PA 
  59.     ON  PA.[GUID] = P.[ADDRESSDATA]
  60. LEFT OUTER JOIN [COUNTRY001] PAC 
  61.     ON  PAC.[GUID] = PA.[COUNTRY]
  62. LEFT OUTER JOIN [COMMUNICATIONDATA] CD
  63.     ON  CD.[PARTNER] = P.[GUID]
  64.     AND CD.[METHOD] = @CommMethod
  65. LEFT OUTER JOIN [PARTNERACCOUNTINGDATA] PAD
  66.     ON  PAD.[GUID] = P.[GUID] 
  67.     AND PAD.[ORGANIZATIONALUNIT] = @Organization
  68.     AND PAD.[VALIDUNTIL] > @MaxDate
  69.     AND PAD.[UPDATEINFOXDELETETIME] < @MinDate
  70. LEFT OUTER JOIN [PARTNERTAXIDENTIFICATION] PTI
  71.     ON  PTI.[GUID] = PAD.[GUID]
  72.     AND PTI.[VALIDUNTIL] > @MaxDate
  73.     AND PTI.[UPDATEINFOXDELETETIME] < @MinDate
  74. --
  75. -- resolving delivery recipient
  76. LEFT OUTER JOIN [PARTNERRELATION] DR 
  77.     ON  DR.[TYPE001] = @DeliveryRecipient 
  78.     AND DR.[SOURCE] = P.[GUID] 
  79.     AND DR.[SOURCEORGANIZATIONALUNIT] = @Organization 
  80.     AND DR.[VALIDUNTIL] > @MaxDate
  81. LEFT OUTER JOIN [PARTNER001] DRP 
  82.     ON  DRP.[GUID] = DR.[TARGET]
  83.     AND DRP.[VALIDUNTIL] > @MaxDate
  84. LEFT OUTER JOIN [ADDRESSDATA] DRPA 
  85.     ON  DRPA.[GUID] = DRP.[ADDRESSDATA]
  86. LEFT OUTER JOIN [COUNTRY001] DRPAC 
  87.     ON  DRPAC.[GUID] = DRPA.[COUNTRY]
  88. LEFT OUTER JOIN [COMMUNICATIONDATA] DRCD
  89.     ON  DRCD.[PARTNER] = DRP.[GUID]
  90.     AND DRCD.[METHOD] = @CommMethod
  91. --
  92. -- resolving invoice recipient
  93. LEFT OUTER JOIN [PARTNERRELATION] IR 
  94.     ON  IR.[TYPE001] = @InvoiceRecipient 
  95.     AND IR.[SOURCE] = P.[GUID] 
  96.     AND IR.[SOURCEORGANIZATIONALUNIT] = @Organization
  97.     AND IR.[VALIDUNTIL] > @MaxDate
  98. LEFT OUTER JOIN [PARTNER001] IRP 
  99.     ON  IRP.[GUID] = IR.[TARGET]
  100.     AND IRP.[VALIDUNTIL] > @MaxDate
  101. LEFT OUTER JOIN [ADDRESSDATA] IRPA 
  102.     ON  IRPA.[GUID] = IRP.[ADDRESSDATA]
  103. LEFT OUTER JOIN [COUNTRY001] IRPAC 
  104.     ON  IRPAC.[GUID] = IRPA.[COUNTRY]
  105. LEFT OUTER JOIN [COMMUNICATIONDATA] IRCD
  106.     ON  IRCD.[PARTNER] = IRP.[GUID]
  107.     AND IRCD.[METHOD] = @CommMethod
  108. --
  109. WHERE 
  110.     P.[VALIDUNTIL] > @MaxDate 
  111. AND P.[UPDATEINFOXDELETETIME] < @MinDate
  112. AND OUP.[CUSTOMER] = '1'
  113. ORDER BY P.[NUMBER001]
======
Jan 7 '07 #1
0 3101

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

Similar topics

19
by: Lauren Quantrell | last post by:
I have a stored procedure using Convert where the exact same Convert string works in the SELECT portion of the procedure but fails in the WHERE portion. The entire SP is listed below....
1
by: Logan X via .NET 247 | last post by:
It's official....Convert blows. I ran a number of tests converting a double to an integer usingboth Convert & CType. I *ASSUMED* that CType would piggy-back ontop of Convert, and that performance...
4
by: Eric Lilja | last post by:
Hello, I've made a templated class Option (a child of the abstract base class OptionBase) that stores an option name (in the form someoption=) and the value belonging to that option. The value is...
7
by: whatluo | last post by:
Hi, all I'm now working on a program which will convert dec number to hex and oct and bin respectively, I've checked the clc but with no luck, so can anybody give me a hit how to make this done...
3
by: Convert TextBox.Text to Int32 Problem | last post by:
Need a little help here. I saw some related posts, so here goes... I have some textboxes which are designed for the user to enter a integer value. In "old school C" we just used the atoi function...
7
by: patang | last post by:
I want to convert amount to words. Is there any funciton available? Example: $230.30 Two Hundred Thirty Dollars and 30/100
6
by: patang | last post by:
Could someone please tell me where am I supposed to put this code. Actually my project has two forms. I created a new module and have put the following code sent by someone. All the function...
1
by: johnlim20088 | last post by:
Hi, Currently I have 6 web projects located in Visual Source Safe 6.0, as usual, everytime I will open solution file located in my local computer, connected to source safe, then check out/check in...
3
by: Scott Bradley | last post by:
Hi All, We are using SQL2000 servers with transact replication to a warm stand-by server. We are seeing the following error from the Log reader agents. Does anyone have any insight on this...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
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: 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
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: 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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
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,...
0
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...

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.