How to convert sql server procedures in the format of oracle

Hello

I need help, I got some procedures that is written in the format MS Sql, I need to convert those to the format of the oracle, and I don't know how to do. Could someone help me?

IN SQL server code format is:

/ * Object: StoredProcedure [dbo]. [sp_rpt_get_job_log_on_demand]    Script Date: 20/12/2013-09:07:26 * /.

SET ANSI_NULLS

GO

SET QUOTED_IDENTIFIER ON

GO

CREATE PROCEDURE [dbo]. [sp_rpt_get_job_log_on_demand]

(

@JOB_ID INT

@REPORT_DATE AS DATETIME

, @PERIOD VARCHAR (100)

)

AS

BEGIN

SET @REPORT_DATE = CONVERT (DATETIME, CONVERT (DATE, @REPORT_DATE))

DECLARE @MONTH INT = (YEAR (@REPORT_DATE) * 100) + MONTH (@REPORT_DATE)

, @TODAY = INT ((((@REPORT_DATE) YEAR * 100) + MONTH (@REPORT_DATE)) * 100) + DAY (@REPORT_DATE)

@YEAR INT = YEAR (@REPORT_DATE)

SELECT J.JOB_ID

J.JOB_NAME

CASE

WHEN F.FREQUENCY_SUBTYPE IS NULL, F.FREQUENCY_TYPE

OF OTHER F.FREQUENCY_TYPE + '-' + F.FREQUENCY_SUBTYPE

END AS FREQUENCY_TYPE

L.TRANSACTION_DATE

L.PROCESS_DATE

START_TIME

END_TIME

DATEDIFF(MINUTE,START_TIME,END_TIME) AS TIME_TAKEN

L.RECORD_COUNT

ISNULL(L.EXECUTION_STATUS, 'NOT STARTED') AS EXECUTION_STATUS

L.ERROR AS ERROR_DESC

P.PRIORITY_NUMBER

P.COLOR_CODE

OF dbo.JOBS J AS

INNER JOIN dbo. ACE OF FREQUENCY F

ON J.FREQUENCY_ID = F.FREQUENCY_ID

INNER JOIN dbo. JOB_PRIORITY AS P

ON J.PRIORITY_ID = P.PRIORITY_ID

LEFT JOIN dbo. TBK_POS_FACT_LOADING_SUMMARY ACE L

ON J.JOB_ID = L.JOB_ID

AND)

(@PERIOD = 'TODAY' AND CONVERT (DATETIME, CONVERT (DATE, L.START_TIME)) = @REPORT_DATE) OR

(@PERIOD = 'MONTHS' AND ((START_TIME) YEAR * 100) + MONTH (START_TIME) = @MONTH) OR

(@PERIOD = 'YEAR' AND YEAR (START_TIME) = @YEAR)

)

AND CONVERT (DATETIME, CONVERT (DATE, L.START_TIME)) < = @REPORT_DATE

WHERE F.FREQUENCY_TYPE <>'NONE'

AND J.JOB_ID = @JOB_ID

UNION ALL

SELECT J.JOB_ID

J.JOB_NAME

CASE

WHEN F.FREQUENCY_SUBTYPE IS NULL, F.FREQUENCY_TYPE

OF OTHER F.FREQUENCY_TYPE + '-' + F.FREQUENCY_SUBTYPE

END AS FREQUENCY_TYPE

L.TRANSACTION_DATE

L.PROCESS_DATE

START_TIME

END_TIME

DATEDIFF(MINUTE,START_TIME,END_TIME) AS TIME_TAKEN

L.RECORD_COUNT

L.EXECUTION_STATUS

L.ERROR AS ERROR_DESC

P.PRIORITY_NUMBER

P.COLOR_CODE

OF dbo.JOBS J AS

INNER JOIN dbo. ACE OF FREQUENCY F

ON J.FREQUENCY_ID = F.FREQUENCY_ID

INNER JOIN dbo. JOB_PRIORITY AS P

ON J.PRIORITY_ID = P.PRIORITY_ID

INNER JOIN dbo. TBK_POS_FACT_LOADING_SUMMARY ACE L

ON J.JOB_ID = L.JOB_ID

WHERE F.FREQUENCY_TYPE = 'NONE '.

AND)

(@PERIOD = 'TODAY' AND CONVERT (DATETIME, CONVERT (DATE, L.START_TIME)) = @REPORT_DATE) OR

(@PERIOD = 'MONTHS' AND ((START_TIME) YEAR * 100) + MONTH (START_TIME) = @MONTH) OR

(@PERIOD = 'YEAR' AND YEAR (START_TIME) = @YEAR)

)

AND J.JOB_ID = @JOB_ID

AND CONVERT (DATETIME, CONVERT (DATE, L.START_TIME)) < = @REPORT_DATE

END

GO

I tried to convert it to a format of oracle... But I get the error message.

--------------------------------------------------------------------------------------------------

CREATE OR REPLACE PROCEDURE POS.sp_rpt_get_job_log_on_demand_V)

JOB_ID NUMBER,

DATE OF REPORT_DATE,

PERIOD VARCHAR2 (100))

AS

BEGIN

l_MONTH: = TO_CHAR (REPORT_DATE, "YYYYMM");

TODAY: = TRUNC (REPORT_DATE);

l_YEAR: = TO_CHAR (REPORT_DATE, 'YYYY');

SELECT J.JOB_ID,

J.JOB_NAME,

CASE

WHEN F.FREQUENCY_SUBTYPE IS NULL, F.FREQUENCY_TYPE

OF OTHER F.FREQUENCY_TYPE | '-' || F.FREQUENCY_SUBTYPE

END

AS FREQUENCY_TYPE.

L.TRANSACTION_DATE,

L.PROCESS_DATE,

START_TIME,

END_TIME,

(END_TIME - START_TIME) AS TIME_TAKEN,

L.RECORD_COUNT,

NVL (L.EXECUTION_STATUS, "NOT STARTED") AS EXECUTION_STATUS,

L.ERROR AS ERROR_DESC,

P.PRIORITY_NUMBER,

P.COLOR_CODE

OF POS.JOBS J.

POINT OF SALE. FREQUENCY F,

POINT OF SALE. JOB_PRIORITY P,.

POINT OF SALE. TBK_POS_FACT_LOADING_SUMMARY L

WHERE J.FREQUENCY_ID = F.FREQUENCY_ID

AND J.PRIORITY_ID = P.PRIORITY_ID

AND J.JOB_ID = L.JOB_ID

(PERIOD = 'TODAY'

AND TO_CHAR (L.START_TIME, 'YYYYMMDD') =

TO_CHAR (REPORT_DATE, 'YYYYMMDD'))

OR (PERIOD = 'MONTHS' AND TO_CHAR (START_TIME, "YYYYMM") = MONTH)

OR (PERIOD = 'YEAR' AND TO_CHAR (START_TIME, 'YYYY') = YEAR)

AND F.FREQUENCY_TYPE <>'NONE'

AND TRUNC (L.START_TIME) < = TRUNC (REPORT_DATE)

AND JOB_ID = J.JOB_ID

UNION ALL

SELECT J.JOB_ID,

J.JOB_NAME,

CASE

WHEN F.FREQUENCY_SUBTYPE IS NULL, F.FREQUENCY_TYPE

OF OTHER F.FREQUENCY_TYPE | '-' || F.FREQUENCY_SUBTYPE

END

AS FREQUENCY_TYPE.

L.TRANSACTION_DATE,

L.PROCESS_DATE,

START_TIME,

END_TIME,

(END_TIME - START_TIME) AS TIME_TAKEN,

L.RECORD_COUNT,

L.EXECUTION_STATUS,

L.ERROR AS ERROR_DESC,

P.PRIORITY_NUMBER,

P.COLOR_CODE

OF POS.JOBS J.

POINT OF SALE. FREQUENCY F,

POINT OF SALE. JOB_PRIORITY P,.

POINT OF SALE. TBK_POS_FACT_LOADING_SUMMARY L

WHERE F.FREQUENCY_TYPE = 'NONE '.

AND J.FREQUENCY_ID = F.FREQUENCY_ID

AND J.PRIORITY_ID = P.PRIORITY_ID

AND J.JOB_ID = L.JOB_ID

(PERIOD = 'TODAY'

AND TO_CHAR (L.START_TIME, 'YYYYMMDD') =

TO_CHAR (REPORT_DATE, 'YYYYMMDD'))

OR (PERIOD = 'MONTHS' AND TO_CHAR (START_TIME, "YYYYMM") = MONTH)

OR (PERIOD = 'YEAR' AND TO_CHAR (START_TIME, 'YYYY') = YEAR)

AND JOB_ID = J.JOB_ID

AND TRUNC (L.START_TIME) < = TRUNC (REPORT_DATE)

END;

/

POS PROCEDURAL errors. SP_RPT_GET_JOB_LOG_ON_DEMAND_V:

LINE/COL ERROR

-------- -----------------------------------------------------------------

4/28 PLS-00103: encountered the symbol "(" quand attend un de la) "

Next:

:= . ), @ % of default characters

The symbol ': = ' has been replaced by "("pour continuer.) "

76/1 PLS-00103: encountered the symbol "END" when awaits an of the

Next:

. (* % & -+; / TA for rem rest mod < an exhibitor > (*))

and or group having intersect less order start union where

connect | multiset

The symbol ';' was replaced by 'END' continue.

Thank you and best regards,

John of Vikash

Keep in mind, DBMS_OUTPUT is reserved for debugging purposes. If you want the output to a front-end, you can use SYS_REFCURSOR as OUTPUT parameter and get the data of the SELECT query.

Tags: Database

Similar Questions

  • How to set sql server date has time format

    Dear Sir.

    I used the windows 7 operating system.

    I have work on scada software to explore siemens wincc.

    I develop the report based on sql server work.

    but the problem is when I put my system date in DDMMYYYY format, so my data was not stored in sql server.

    but when

    I put my system date in YYYYMMDD format, then my data stored in sql server.

    so, how to change the date format sql server.

    I am attaching screenshot (it is a red box, so this date format, I held DDMMYYYY)

    Please give solution.

    Abhijit Hello,

    Thank you for visiting Microsoft Community and we provide a detailed description of the issue.

    According to the description, I understand that you have a question setting SQL server date time format. When you try to set the system date format id ddmmy, the data are not stored in SQL server on the system.

    To get more information about it, we have a dedicated forum where these issues are dealt with and would be better suited to the TechNet community.

    Please visit the link below to find a community that will provide the best support.

    https://social.technet.Microsoft.com/search/en-us/TechNet?query=SQL%20server&beta=0&AC=4#refinementChanges=129&PageNumber=1&showMore=false

    I hope this information is useful.

    Please let us know if you need more help, we will be happy to help you.

    Thank you.

  • How to convert a PDF file to the format letter rather than A4 size?

    I'm a little frustrated.  I'm trying to convert a PDF to a Word, format letter size.  Instead, it uses by default a format A4.  How can I change the default setting?  I use Windows 7 Professional.

    Jack

    After exporting, you can edit the image file using a graphical editor.

  • How to convert a number in bar code format in oracle ADF?

    Hello

    In oracle adf application I want to convert the format of a column in my view object is displayed as a barcode without changing its data type in the database table?

    Thank you

    Check this URL:

    Blog of Ashish Awasthi (Jdev/ADF): generate the barcode Image in Oracle ADF using the OnBarcode API

  • CF 11 Post update 3 issue - [SQLServer JDBC Driver] [SQL Server] procedure or a function expects the parameter which is not provided.

    Information on ColdFusion 11:

    Server details
    Server productColdFusion
    Version11,0,03,292480
    Version of Tomcat7.0.54.0
    EditionDeveloper
    Operating systemWindows 8
    OS version6.2
    Update levelC:/ColdFusion11/cfusion/lib/updates/chf11000003.jar
    Version of the Adobe driver5.1.3 (build 000094)

    Sample error:

    queryError[Macromedia] [SQLServer JDBC Driver] [SQL Server] Procedure or function 'ListClientDPReceiptFormat' expects the parameter '@idCient', which was not provided.
    where(param 1) = [type = 'IN', class = 'java.lang.Integer', value = '4', sqltype = "CF_SQL_INTEGER"]

    Stored procedure:

    < procedure CFSTOREDPROC = "ListClientDPReceiptFormat" >
    "< CFPROCPARAM TYPE = 'IN' DBVARNAME ="@idClient"VALUE =" #Request.Client.Id # "" CFSQLTYPE = "CF_SQL_INTEGER" >
    < CFPROCRESULT NAME = "qryDPReceiptFormats" >
    < / CFSTOREDPROC >

    This stored procedure and other like it worked fine until the update from CF 11 3 has been applied.

    Thank you!

    It seems to be a typo here. Can clarify you...

    The error "[Macromedia] [SQLServer JDBC Driver] [SQL Server] procedure or function 'ListClientDPReceiptFormat' expects the parameter '@idCient', which was not provided."  the parameter defined as @idCient but your cfprocparam dbvarname = has ' @idClient'. .

    These are spelled differently.


    I think that this may be related to what is mentioned in this bug - Bug #3865064 - ColdFusion 11 3 CFPROCRESULT case update


    Adam Cameron notes:


    " Basically, then, it's a matter of the code in question was wrong, but the user has been getting away with it because the DBVARNAME was ignored. Now that it is not ignored, the code must actually be legitimate ;-). Very well, in that case. »


  • When installing sql server 2014 in windows 7, an error triggered bootstrapper has stopped his work help me please how to install sql server in 2014.

    When installing sql server 2014 in windows 7, an error triggered bootstrapper ceased his work please help me how to install sql server 2014

    Hello

    Your question is beyond the scope of this community.

    Please repost your question in the SQL Server TechNet Forums.

    https://social.technet.Microsoft.com/forums/SQLServer/en-us/home?category=SQLServer

    See you soon.

  • Installation of the SQL Server Agent on the Virtual Center Server

    Hello everyone

    I installed VC2.5 on a PowerEdge 1950 server.  The SQL VC database will reside on a different server, of course, I understand that you need to create a system DSN.  But he also stated that the "SQL Server Agent" must run on the VC server.  How to install SQL Server agent?  It is installed from the SQL installation CD?

    Thank you!!!

    SQL Agent is part of the SQL Server installation and only would be located on the database server.

  • How to convert Blu Ray Disc of the movie in general video and HD video formats

    How to convert Blu Ray Disc of the movie in general video and HD video formats

    Hello

    I doubt that this is possible because Bluray discs are mostly protected against copying.
    But if you have the Bluray m2ts file on your HARD drive, then you could try the tool called convertXtodvd. But I don't see that the reasons for this
    I mean that you will lose the quality of film converting the blueray to dvd.

  • How to convert table 1 d of the only single

    Hye, I am brand new in Labview. Can someone help me how to convert arrray 1 d of the only sin

    GLE.

    Use Index

  • Question: insertion of several lines in the MS Sql Server table using the DB adapter

    Hi all

    I managed to insert a single row in a table of MS SQL Server via the adapter DB to my process BPEL, but when I tried to insert in mutiple lines in the same table of MS SQL server, I encounter the error below.

    I use a DB SQL XA connection to connect to the server.

    Kindly help me to solve the problem. Thanks in advance.

    Error:

    " < bpelFault > < faultType > 0 < / faultType > < remoteFault xmlns =" http://schemas.Oracle.com/BPEL/extension "> < a name ="summary"part > < summary > exemption is is produced when the binding was used." Exception occurred during invocation of the JCA binding: "JCA binding run 'merge' reference operations have to: DBWriteInteractionSpec Execute Failed Exception." the merger failed. The descriptor name: [LoadCmpAggSpendStage.SapTable]. Caused by com.microsoft.sqlserver.jdbc.SQLServerException: incorrect syntax near ')'... Check the logs for the record output full DBAdapter before this exception. This exception is considered as reproducible, probably due to a communication failure. To be classified as not reproducible rather add property nonRetriableErrorCodes with the '102' value in the deployment descriptor (i.e. weblogic - RA.Xml). Auto retry a reproducible fault set composite.xml for this invoke these properties: jca.retry.interval, jca.retry.count and jca.retry.backoff. All properties are integers. ". The called JCA adapter threw an exception of resource. Please examine the error message above carefully to determine a resolution. < /Summary. (> < / piece > < part name = "detail" > < detail syntax > incorrect near ')'. < / details > < / piece > < part name = "code" > < code > 102 < / code > < / piece > < / remoteFault > < / bpelFault >

    Kind regards

    Balaji Rahmani

    It seems that in this case is called merge operation. If existing records (check primary key) are not there then it will be inserted on the other update. Check the syntax of the query that is created. It looks like she may have a supplement "). If you want to only insert then call insert operation and not merge.

  • Question: Is SQL Server 2014 on the roadmap for vSphere?

    Hello community,

    one of our clients is planning to implement Microsoft SQL Server 2014.

    Is SQL Server 2014 on the roadmap for VMware vSphere and the Update Manager?

    Or is it possible and supported to run vSphere 5.5 on a Microsoft SQL Server 2014.

    Kind regards

    Michael Winkenbach

    Hi Michael,

    Here you can check what VMware products are supported on what databases: VMware product interoperability Matrices

    MS SQL 2014 is not yet.

    Perhaps the next major release of vSphere will support it. Maybe we'll here on this subject at VMworld?

    So far I would say your client to not migrate databases of vSphere.

    Tim

  • How to convert a layer back to the text "T? He is currently uneditable (how did that happen?).

    How to convert a layer back to the text "T? He is currently uneditable and I want to change the font (also, how what happened?).

    According to your layers panel. The top layer is a text layer years the second layer is a raster layer. A raster layer once the case has been closed, cannot be cancelled. It will have to be re-created. If for some reason, you left the file open, then it is perhaps possible to cancel it, because it would show in the history stack. But by default that stack is set to 20 States, to more than 20 he would push the battery.

    I think that you have to bite the bullet and redo this layer.

  • See cant SQL Server tab on the New/Select database connection

    Hi all

    I can't see the SQL Server tab in the new database connection window. I added the jdbc SQL Server driver using the tools-> Preferences-> Third Party JDBC Driver, but all I can see are the Oracle and the tabs to Access.

    I use the version 1.5.4.

    Pointers is very appreciated.

    Kind regards
    Anish.

    Note that the jdbc (for Sybase and SQL Server) driver is http://jtds.sourceforge.net/ jtds1.2 or jtds1.2.2

    -Turloch

  • How to convert my document scan to pdf format?

    How to convert my document scan to pdf format?

    Hi davidp33429376,

    When parsing the document, you will also be able to save it as a PDF file, it is the feature of your application to scan.

    Later, you can view the PDF in reader Adobe - Adobe Acrobat Reader DC Distribution

    Kind regards

    Nicos

  • How to convert a word document to PDF format?

    Please teach me step by step on how to convert several Word documents to PDF format?

    Is properly installed and updated (depending on the version of WORD), you can simply do the following:

    1. open the doc in WORD and click on print, select the Adobe PDF printer, print.

    2. open the doc in WORD and go to the Acrobat menu in WORD and select Create PDF (this example uses PDF Maker).

    3. open the document in Acrobat and conversion to do based on PDF Maker.

Maybe you are looking for

  • Windows software

    Information about adding windows software to allow the iMac running windows programs

  • Control a bath of hot water of RS - 232

    Hello I'm looking for suggestions on hot to control a water bath using a RS-232.  A week ago I want the computer communicates with the hot water bath, using an example called LabView "base read and write". Now, I want to set up an experience.  I want

  • Data accuracy for USB-9219

    Hello Does anyone have data accuracty and repeatability of the actual temperature for the NI USB-9219 with the collaboration of class A (0.06%) PT 100 RTD (0.0385)? Thank you Michael

  • G42-415dx: 2 sheets with different information online

    Hello When I go through the Office of support for this laptop model site, I get a one page fact sheet that says max ram is 8GB. When I went to the support page mobile and download the full pdf with instructions of systems and the part #, it says max

  • All my programs have gone after recovery and full system restore

    I did a full restore and system recovery my computer without saving my programs or files and now all my programs are gone. The only thing that's on my desk is in the trash. How can I get my dos programs? __ Media Player, media library, Java, ect...