Oracle Database - Oracle PROCEDURE - New to Oracle

Asked By Niz Niz on 10-Jun-14 11:58 AM

Hello,

I am new to Oracle. Come from an SQL / Sybase background and struggling to create a procedure that simply should output a set of fields from a table.


I am looking to create a Stored Procedure in Oracle that is equivalent on SQL/Sybase as follows;


CREATE PROCEDURE ListTransactions @StartDate datetime, @EndDate datetime AS
 
DECLARE @ReportDate datetime
SET @ReportDate = CONVERT(datetime,CONVERT(VARCHAR,GETDATE(), 103), 103)    --Sets Currenct System Date as Report Date
 
SELECT
  @ReportDate,
  trn.TransactionDate,
  cp.CounterPartyName,
  cu.Currency_Name,
  trn.Amount,
  trn.PostedBy,
  trn.Comments
FROM
  Transactions trn
  LEFT JOIN CounterParties cp ON trn.CounterParty_Id = cp.CounterParty_Id
  LEFT JOIN Currency cu ON trn.Currency_Id = cu.Currency_Id
WHERE
  trn.TransactionDate Between @StartDate AND @EndDate