oracle - ORA:00900 - Invalid SQL Statement -


i new vast world of oracle. trying is, creating stored procedure , retrieve result. procedure goes as

create or replace procedure usp_rotaplateproductie_select( afdelingid in varchar2, producttypeid in varchar2, productiedata out sys_refcursor)  begin open productiedata select rotaplateproductie.batchnummer, cpiplusproductieorder.productnummer,     product.omschrijving, productieresultaatrtplrol.bruto_in_meters     rotaplateproductie inner join productieresultaatrtplrol on     rotaplateproductie.batchnummer = productieresultaatrtplrol.batchnummer      inner join cpiplusproductieorder on      productieresultaatrtplrol.productienummer =  cpiplusproductieorder.productnummer      inner join product on     cpiplusproductieorder.productnummer = product.productnummer     rotaplateproductie.afdelingid = '3144' , rotaplateproductie.producttype = 'pt005'    end; 

and using below code trying execute it.

var rc refcursor exec usp_rotaplateproductie_select('3144','pt005', :rc); 

while executing above lines getting ora:00900 error.

when run query part of procedure, running fine procedure gives me error.

as shareef pointed out you're missing semicolon on statement inside procedure, doesn't you're creating properly. need / after procedure tell oracle execute code , creation. think it's seeing var , exec statements part of single call, incorrect. i'm not sure how you're running this; if it's in sql developer need 'run script' (f5) rather 'run'.

create or replace procedure usp_rotaplateproductie_select(     p_afdelingid in varchar2,     p_producttypeid in varchar2,     p_productiedata out sys_refcursor)  begin     open p_productiedata         select rotaplateproductie.batchnummer, cpiplusproductieorder.productnummer,             product.omschrijving, productieresultaatrtplrol.bruto_in_meters         rotaplateproductie         inner join productieresultaatrtplrol on             rotaplateproductie.batchnummer = productieresultaatrtplrol.batchnummer          inner join cpiplusproductieorder on              productieresultaatrtplrol.productienummer = cpiplusproductieorder.productnummer          inner join product on             cpiplusproductieorder.productnummer = product.productnummer         rotaplateproductie.afdelingid = p_afdelingid         , rotaplateproductie.producttype = p_producttypeid;  end; / var rc refcursor exec usp_rotaplateproductie_select('3144','pt005', :rc); print :rc 

i've switched use in parameters, , i've taken liberty of changing names can distinguish between parameters , column names; same can cause confusion.

you might find useful alias tables; no functional difference maybe easier read:

create or replace procedure usp_rotaplateproductie_select(     p_afdelingid in varchar2,     p_producttypeid in varchar2,     p_productiedata out sys_refcursor)  begin     open p_productiedata         select rp.batchnummer, cppo.productnummer,             p.omschrijving, pra.bruto_in_meters         rotaplateproductie rp         inner join productieresultaatrtplrol par             on rp.batchnummer = pra.batchnummer          inner join cpiplusproductieorder cppo             on pra.productienummer = cppo.productnummer          inner join product p             on cppo.productnummer = p.productnummer         rp.afdelingid = p_afdelingid         , rp.producttype = p_producttypeid;  end; / 

if message procedure compiled warnings, 'show errors' details.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c++ - Using OpenSSL in a multi-threaded application -

All overlapping substrings matching a java regex -