I have been working with SQL Server for many years now. But there was a requirement in my current project where I had to convert the procedure written in SQL Server to Oracle (in SQL Developer tool).
But there seems to be a lot of minutes syntax changes which I am unable figure out with the error messages thrown.
Here is my stored procedure:
CREATE OR REPLACE PROCEDURE PROC_MyPROC
(
PAGENUMBER IN NUMBER
, PAGESIZE IN NUMBER
, SEARCHTERM IN VARCHAR2
, TOTAL IN NUMBER
) AS
BEGIN
IF(PAGENUMBER=1)
THEN
SELECT COUNT(distinct mastraccnt.T1Column1) INTO TOTAL
FROM Table1 mastraccnt
JOIN Table2 req on LTRIM(RTRIM(req.T2Column1)) = LTRIM(RTRIM(mastraccnt.T1Column1))
WHERE LOWER(RTRIM(LTRIM(mastraccnt.T1Column1))||' - '||RTRIM(LTRIM(req.T2Column2))) like
'%'||LOWER(SEARCHTERM)||'%';
END IF;
SELECT distinct RTRIM(LTRIM(mastraccnt.T1Column1)) as MasterAccountId,
RTRIM(LTRIM(mastraccnt.T1Column1))||' - '|| RTRIM(LTRIM(req.T2Column2)) as MasterAccountName,
TOTAL AS TotalRows
FROM Table1 mastraccnt
JOIN Table2 req on LTRIM(RTRIM(req.T2Column1)) = LTRIM(RTRIM(mastraccnt.T1Column1))
WHERE LOWER(RTRIM(LTRIM(mastraccnt.T1Column1))||' - '||RTRIM(LTRIM(req.T2Column2))) like
'%'||LOWER(SearchTerm)||'%'
ORDER BY MasterAccountName
OFFSET PAGESIZE * (PAGENUMBER - 1) ROWS
FETCH NEXT PAGESIZE ROWS ONLY;
END PROC_MyPROC;
On compiling this i get these errors, not sure what they mean. Can someone help me what is wrong with my procedure?
