Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Unable to insert row with calling stored procedure in ADF

Okan SutcuogluOct 16 2018 — edited Oct 16 2018

Hi everyone. I use JDeveloper 12.2.1.3 and JDK 1.8.171

I looked this thread over here : how to call a stored procedure in ADF

I did the same think and i succeded.

But when i try to add an insert code or delete code in the procedure like:

CREATE or REPLACE PROCEDURE SP_HELLOWORLD

(

  NAME IN VARCHAR2

, WISHES OUT VARCHAR2

) AS

BEGIN

WISHES:= 'Hello '||name||', Welcome to SP. ';

INSERT INTO EMPLOYEES VALUES(300,'Okan','Sutcuoglu','OSUTCUOGLU','650.507.9833',SYSDATE,'FI_MGR',200,null,124,50);

END SP_HELLOWORLD;

It does not insert or delete any row.

When i run just the insert code it inserts the row but in the procedure it does not.

I call the procedure in the appmoduleimpl like :

        try {

            System.out.println("***************** Start of code ****************");

            String sql = "begin SP_HELLOWORLD(:NAME,:WISHES); end; ";

            CallableStatement st = getDBTransaction().createCallableStatement(sql, getDBTransaction().DEFAULT);

            st.setObject("NAME", "ABC"); // replace with required param

            st.registerOutParameter("WISHES", Types.VARCHAR); //import java.sql.Types;

            st.execute();

            System.out.println(" The output of the DB function is : " + st.getObject("WISHES"));

            System.out.println("***************** End of code ****************");

        } catch (Exception e) {

            e.printStackTrace();

        }

It returns me 

***************** Start of code ****************

The output of the DB function is : Hello ABC, Welcome to SP.

***************** End of code ****************

But does not insert the row.

This post has been answered by Okan Sutcuoglu on Oct 16 2018
Jump to Answer
Comments
Post Details
Added on Oct 16 2018
1 comment
237 views