How to call procedure in jdeveloper ?
hi ,
I wrote a procedure in database , but I don't know how to call it in jdeveloper 11g . Can somebody give some advice or material ? thanks !!
Calling a stored procedure in Java has more then one way. The way Timo showed is the ADF BC way. The more common way from a Java program is to use JDBC with DataSource and CallableStatements. The Oracle RDBMS JDBC guide shows a short intro to JDBC and the Oracle JDBC driver specifics. http://download.oracle.com/docs/cd/E11882_01/java.112/e10589/toc.htm
Another way is to use the Database Navigator and run/debug the stored procedure.
--olaf
Similar Messages
-
How to Call Procedure or Function
Hi,
How to call a procedure or function in apex, Please let me know
Thanks
SudhirHi,
This post might help
Re: How to Call procedure In Processes
Regards,
Jari -
How to call procedure in Java from SQL Server Database
Hello Every Body
i Have Question about
How to call procedure in Java from SQL Server Database
ThanksHi,
have you tried a Google search? I just gave it a 3 second try and already found: http://stackoverflow.com/questions/6113674/how-do-i-execute-a-ms-sql-server-stored-procedure-in-java-jsp-returning-table-d
Frank -
How to call procedure and package in BI
IN OBIEE how to call procedure- function and pass parameter in it.??
Thanks
Jatin.Do you mean DB function. Check this link:
http://oracle-bi.siebelunleashed.com/articles/callingdb-function-in-obiee/
For OBIEE 11g, you have additional options to make calls with Action Framework. For now, I think the above link will help.
If helpful pls mark as correct or helpful -
How to call procedure in which one formal parameter is associative array ty
how to call procedure in which one formal parameter is associative array type,
pls explain with eg.>
above code work fine but when i use case then it give error like
i identifier should be declare
& my code is as
CASE v_array(i)
WHEN 'A' THEN
insert into di_ivpn_report (ID, test_name, table_name, status, entity, proposition)
values (v_att_id, v_att_name, 'DI_'||v_array(i)||'_REPORT'||'_'||v_att_id,
v_status, v_ent_name, v_array(i));
WHEN 'B' THEN
insert into di_mpls_report (ID, test_name, table_name, status, entity, proposition)
values (v_att_id, v_att_name, 'DI_'||v_array(i)||'_REPORT'||'_'||v_att_id,
v_status, v_ent_name, v_array(i));
END CASE;
>
Then you have to use ordinary loop
PROCEDURE insert_update_***_array (TRANID IN VARCHAR2, ATT_NAME IN VARCHAR2, ENT_NAME VARCHAR2, v_array IN ***_array)
IS
v_tranid VARCHAR2(1);
v_att_name VARCHAR2(100) := ATT_NAME;
v_ent_name VARCHAR2(100) := ENT_NAME;
v_att_id VARCHAR2(6);
v_ent_id NUMBER;
v_status VARCHAR2(20) DEFAULT 'INACTIVE';
I NUMBER;
BEGIN
i := v_array.first;
while i is not null loop
CASE v_array(i)
WHEN 'A' THEN
insert into di_ivpn_report (ID, test_name, table_name, status, entity, proposition)
values (v_att_id, v_att_name, 'DI_'||v_array(i)||'_REPORT'||'_'||v_att_id,
v_status, v_ent_name, v_array(i));
WHEN 'B' THEN
insert into di_mpls_report (ID, test_name, table_name, status, entity, proposition)
values (v_att_id, v_att_name, 'DI_'||v_array(i)||'_REPORT'||'_'||v_att_id,
v_status, v_ent_name, v_array(i));
END CASE;
i := v_array.next(i);
end loop;
end; -
hai,
how to call pl/sql procedure
using jdeveloper?
any one may help.
thanks
pullareddy
nullFirst register a DriverManager.
Then create a new Connection using DriverManager.getConnection().
Then make a CallableStatement using CallableStatement.prepareCall(String PL/SQLStatement);
execute the statement (CallableStatement.execute()).
Finally, commit the connection.
Hope this helps. -
How to call Procedure in Forms
Hi All,
I'm having 1Form,in that one check box is there if i check that, if i save the form means it should automatically call the procedure.
Can any one know how to call th procedure inside the Form.When we save form procedure sholud call and Run.
Bit urget plsss
Regards
Sivathanks for ur reply,
i have got the solution
Cloding the Thread..
Regards
Siva -
How I call procedure in interactive report??
Hi
Is possible that call procedure in interactive report on APEX?
Because
in region source it asked only sql statement so I am confused and I dont know how call procedure in interactive report ?
Edited by: esra aktas on 12.May.2011 11:04
Edited by: esra aktas on 12.May.2011 12:05I am confused... Now, acoording to my senior porject in school my advisor want to that lots of procedures' name and arguments that I have collect them in a table. I collected procedures in table then I wrote a procedure that call wanted procedure by using dynamic sql and run that procedure..I select procedure name on selectlist on apex then that procedure run.
So I want to my procedure's results must be as dataset in report . But report's source want to sql statement but I want to call the procedure as I mentioned.
If you have any idea about my situations , I want to get your adviced.
I have a this procedure.
create or replace
PROCEDURE CALLSPFROMTABLE(id number,arg1 varchar2,arg2 varchar2) as
table_name varchar2(30):='procedures';
procname varchar2(1000);
begin
EXECUTE IMMEDIATE 'select procname from ' || table_name || ' where id='||id into procname;
EXECUTE IMMEDIATE 'BEGIN '||procname||'('||arg1||','||arg2||'); END;';
END;id=>:p1_SP , arg1=>:P1_YIL arg2=>:P1_BIRIM from selectlists
Edited by: esra aktas on 12.May.2011 13:08
Edited by: esra aktas on 12.May.2011 13:17 -
How to call procedure from java
My database : oracle xe 10g
I develop my application by use jdeveloper
I call procedure following code :
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection c = (Connection)DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "shm", "shm");
CallableStatement cs = c.prepareCall("begin shm_increase_capital.ins_upd_tb_payment_rec_pc(:1,:2,:3,:4,:5,:6,:7);end;");
cs.setLong(1, shareHolderId);
cs.setString(2, companyCode);
cs.setString(3, lotYear);
cs.setLong(4, seqLot);
cs.setLong(5, allocateId);
cs.setLong(6, originateFrom);
cs.setString(7, curUser);
cs.execute();
cs.close();
c.close();
When I run my application several times I found error :
Exception in thread "main" java.sql.SQLException: Listener refused the connection with the following error:
ORA-12519, TNS:no appropriate service handler found
The Connection descriptor used by the client was:
localhost:1521:XE
Do you have another way for call procedure
Please recommend me
Thank you,
Ja-aeI can call procedure
but when I using my application too long
I found error :
Exception in thread "main" java.sql.SQLException: Listener refused the connection with the following error:
ORA-12519, TNS:no appropriate service handler found
The Connection descriptor used by the client was:
localhost:1521:XE
so, I think perhaps another way to call procedure for avoid this error -
How to call procedure (procedure name is in text)
For example
Table1 is table field1, field2 is Table1's fields. Data 'procedure1' is In Field2 (Field2 is varchar2).
procedure1 is stored procedure's name
How to call procedure1 that selected from Table1.
Please helpTables don't have fields.
You need to find a 3GL forum.
Thank you.
Sybrand Bakker
Senior Oracle DBA -
How to call procedure from OCI ?
How to call oracle procedure from OCI ?
Following works on Windows, your mileage may vary. IIRC one of the standard OCI examples that install with the libraries demonstrates this too.
/* SQL to create table and Stored Procedures */
Create table OCI8StoredProcedureSampleTable
(field1 number(5), field2 varchar2(30));
CREATE OR REPLACE PROCEDURE OCI8StoredProcedureSample3
(field1 number, field2 IN OUT varchar2)
is
begin
insert into OCI8StoredProcedureSampleTable values (field1, field2);
Commit;
field2 := 'Successful';
end;
CREATE OR REPLACE PROCEDURE OCI8StoredProcedureSample4
(field1 number, field2 char, field3 OUT varchar2)
is
begin
insert into OCI8StoredProcedureSampleTable values (field1, field2);
Commit;
field3 := 'Successful';
end;
CREATE OR REPLACE FUNCTION OCI8StoredProcedureSample5
RETURN VARCHAR2
is
v_Sysdate DATE;
v_charSysdate VARCHAR2(20);
begin
SELECT TO_CHAR(SYSDATE, 'dd-mon-yyyy') into v_charSysdate FROM DUAL;
return(v_charSysdate);
end;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <oci.h>
static void checkerr (OCIError *p_err, sword status);
void main()
OCIEnv *p_env;
OCIError *p_err;
OCISvcCtx *p_svc;
OCIStmt *p_sql;
OCIBind p_Bind1 = (OCIBind ) 0;
OCIBind p_Bind2 = (OCIBind ) 0;
OCIBind p_Bind3 = (OCIBind ) 0;
OCIDefine p_define1 = (OCIDefine ) 0;
char field2[20] = "Entry 3";
char *field3;
//char field3[20];
sword field1 = 3;
text mySql = (text ) "Begin OCI8StoredProcedureSample3(:field1, :field2); END;";
printf("OCIInitialize\n");
checkerr(p_err, OCIInitialize((ub4) OCI_OBJECT,
(dvoid *) 0, (dvoid * (*) ()) 0,
(dvoid * (*) ()) 0, (void (*) ()) 0));
printf("OCIEnvInit\n");
checkerr(p_err, OCIEnvInit(&p_env, (ub4) OCI_DEFAULT,
(size_t) 0, (dvoid **)0));
printf("OCIHandleAlloc\n");
checkerr(p_err, OCIHandleAlloc(p_env, &p_err, OCI_HTYPE_ERROR,
(size_t) 0, (dvoid **) 0));
printf("OCIHandleAlloc\n");
checkerr(p_err, OCIHandleAlloc(p_env, &p_svc, OCI_HTYPE_SVCCTX,
(size_t) 0, (dvoid **) 0));
printf("OCIHandleAlloc\n");
checkerr(p_err, OCIHandleAlloc(p_env, &p_sql, OCI_HTYPE_STMT, (size_t) 0, (dvoid **) 0));
printf("OCILogon\n\n");
checkerr(p_err, OCILogon(p_env, p_err, &p_svc, "SCOTT", 5, "TIGER", 5, "V8", 2));
/* Example 1 - Using an IN OUT Parameters */
printf("*************************************************\n");
printf("Example 1 - Using an IN OUT Parameters\n");
printf("*************************************************\n");
printf(" OCIStmtPrepare\n");
printf(" %s\n",mySql);
checkerr(p_err, OCIStmtPrepare(p_sql, p_err, mySql,
(ub4) strlen(mySql), OCI_NTV_SYNTAX, OCI_DEFAULT));
printf(" OCIBindByPos 1\n");
checkerr(p_err, OCIBindByPos(p_sql, &p_Bind1, p_err, 1, (dvoid *) &field1, sizeof(sword),
SQLT_INT, 0, 0, 0, 0, 0, OCI_DEFAULT));
printf(" OCIBindByPos 2\n");
checkerr(p_err, OCIBindByPos(p_sql, &p_Bind2, p_err, 2, field2, (sizeof(field2) - 1),
SQLT_CHR, 0, 0, 0, 0, 0, OCI_DEFAULT));
printf(" Field2 Before:\n");
printf(" size ---> %d\n", sizeof(field2));
printf(" length ---> %d\n", strlen(field2));
printf(" value ---> %s\n", field2);
printf(" OCIStmtExecute\n");
checkerr(p_err, OCIStmtExecute(p_svc, p_sql, p_err, (ub4) 1, (ub4) 0, (OCISnapshot *)
NULL, (OCISnapshot *) NULL, (ub4) OCI_COMMIT_ON_SUCCESS));
printf(" Field2 After:\n");
printf(" size ---> %d\n", sizeof(field2));
printf(" length ---> %d\n", strlen(field2));
printf(" value ---> %s\n", field2);
/* Example 2 - Using OUT Parameters */
field1 = 4;
strcpy(field2, "Entry 4");
printf("\n\n*************************************************\n");
printf("Example 2 - Using OUT Parameters\n");
printf("*************************************************\n");
printf(" OCIStmtPrepare\n");
strcpy(mySql,(text *) "Begin OCI8StoredProcedureSample4(:field1, :field2, :field3); END;");
printf(" %s\n",mySql);
checkerr(p_err, OCIStmtPrepare(p_sql, p_err, mySql,
(ub4) strlen(mySql), OCI_NTV_SYNTAX, OCI_DEFAULT));
printf(" OCIBindByPos 1\n");
checkerr(p_err, OCIBindByPos(p_sql, &p_Bind1, p_err, 1, (dvoid *) &field1, sizeof(sword),
SQLT_INT, 0, 0, 0, 0, 0, OCI_DEFAULT));
printf(" OCIBindByPos 2\n");
checkerr(p_err, OCIBindByPos(p_sql, &p_Bind2, p_err, 2, field2, strlen(field2),
SQLT_CHR, 0, 0, 0, 0, 0, OCI_DEFAULT));
printf(" OCIBindByPos 3\n");
checkerr(p_err, OCIBindByPos(p_sql, &p_Bind3, p_err, 3, field3, 19,
SQLT_CHR, 0, 0, 0, 0, 0, OCI_DEFAULT));
printf(" OCIStmtExecute\n");
checkerr(p_err, OCIStmtExecute(p_svc, p_sql, p_err, (ub4) 1, (ub4) 0, (OCISnapshot *)
NULL, (OCISnapshot *) NULL, (ub4) OCI_COMMIT_ON_SUCCESS));
printf(" Field3 After:\n");
printf(" size ---> %d\n", sizeof(field3));
printf(" length ---> %d\n", strlen(field3));
printf(" value ---> %s\n", field3);
/* Example 3 - Using a Function to Return a Value */
printf("\n\n*************************************************\n");
printf("Example 3 - Using a Function to Return a Value \n");
printf("*************************************************\n");
printf(" OCIStmtPrepare\n");
strcpy(mySql,(text *) "SELECT OCI8StoredProcedureSample5 from DUAL");
printf(" %s\n",mySql);
checkerr(p_err, OCIStmtPrepare(p_sql, p_err, mySql,
(ub4) strlen(mySql), OCI_NTV_SYNTAX, OCI_DEFAULT));
checkerr(p_err, OCIDefineByPos(p_sql, &p_define1, p_err, 1, (dvoid *) field3,
(sword) 20, SQLT_STR, (dvoid *) 0, (ub2 *)0, (ub2 *)0, OCI_DEFAULT));
printf(" OCIStmtExecute\n");
checkerr(p_err, OCIStmtExecute(p_svc, p_sql, p_err, (ub4) 1, (ub4) 0, (OCISnapshot *)
NULL, (OCISnapshot *) NULL, (ub4) OCI_COMMIT_ON_SUCCESS));
printf(" The return value:\n");
printf(" size ---> %d\n", sizeof(field3));
printf(" length ---> %d\n", strlen(field3));
printf(" value ---> %s\n", field3);
return;
static void checkerr(errhp, status)
OCIError *errhp;sword status;
text errbuf[512];
ub4 errcode;
switch (status)
case OCI_SUCCESS:
break;
case OCI_SUCCESS_WITH_INFO:
printf("Error - OCI_SUCCESS_WITH_INFO\n");
break;
case OCI_NEED_DATA:
printf("Error - OCI_NEED_DATA\n");
break;
case OCI_NO_DATA:
printf("Error - OCI_NO_DATA\n");
break;
case OCI_ERROR:
OCIErrorGet ((dvoid *) errhp, (ub4) 1, (text *) NULL, &errcode,
errbuf, (ub4) sizeof(errbuf), (ub4) OCI_HTYPE_ERROR);
printf("Error - %s\n", errbuf);
break;
case OCI_INVALID_HANDLE:
printf("Error - OCI_INVALID_HANDLE\n");
break;
case OCI_STILL_EXECUTING:
printf("Error - OCI_STILL_EXECUTE\n");
break;
case OCI_CONTINUE:
printf("Error - OCI_CONTINUE\n");
break;
default:
break; -
How to call procedure which is another database
I have two procedure1 and procedure2 on two different database1 and database2. I want to call procedure2 inside the procedure1. Can you please give me the steps(including creating DBLink) how can this be done.
ThanksThe best way of doing this is to use a synonym for the remote procedure.
The documentation explains how to create a database link. The exact syntax you use depends on your security policies and how the connection is going to work.
Similarly the documentation explains how to create synonyms. You may also find this piece helpful.
Then it's simply a matter of writing PROC_1 so that it calls PROC_2 using the synonym. Do not under any circumstances use the database link in PROC_1. It makes deploying the code to other other environments (UAT, PRODUCTION) more complicated than is strictly necessary.
Cheers, APC -
How to call procedure in triger
Hi,
Step1:
Create trigger (before insert) on emp1 table wich will call the another procedure(in Step:2)
Step2:
create procedure which is having in out parameter as type emp1.ename
display the ename before inserting
change the ename to mallikarjun kotturu
display the ename after insert.
Your final data should be 1000 as eid and mallikarju kotturu as ename in the table.
How to do this. Please Help me.
Regards'
Venkat.table emp1 contain with 2 coloumns.
empno 1000, ename: Jhon
before insert display data get from table and display as 'Jhon' ;
Afetr insert Display with new value.ex: insert 'Jhon son; Display as jhonson.
i got the new value as a :new.ename but
How can i get the old value. -
How to Call procedure In Processes
Hi,
i have create Procedure abc.
How can i call abc procedure in Processes in Page Processing .
i want to call that procedure when i press submit button.
Thankshi, thanks to reply me.
Like
begin
abc();---Procedure name
end;
it's correct or not.
Thanks -
How to call procedure with Object types in java
Hi,
We have procedure declaration as follows
===============
TYPE TEST_TYPE AS OBJECT (NAME VARCHAR2(10));
TYPE TESTTYPE1 AS object (student1 TESTTYPE,student2 TESTTYPE,student3 TESTTYPE);
TYPE rect AS OBJECT
-- The type has 3 attributes.
length NUMBER,
width NUMBER,
area NUMBER,
-- Define a constructor that has only 2 parameters.
CONSTRUCTOR FUNCTION rect(length NUMBER, width NUMBER)
RETURN SELF AS RESULT
PROCEDURE G(obj1 in TESTTYPE1,obj2 out rect) as
n1 testtype;
n2 testtype;
n3 testtype;
n4 testtype;
begin
obj2 := NEW rect(10,20,200);
n1 := obj1.student1;
n2 := obj1.student2;
n3 := obj1.student3;
obj2.length :=20;
end;
=====================================================
I am not able to call the procedure in java code as I cannot figure out which out parameter type will it be registered using registeroutparameter. using cursor or struct type fails.
please let me know how I can pass values from stored procedure with objects to java.I'm not sure what you're trying to accomplish with your procedure, but in general, this is an example of how you could use oracle.sql.STRUCT.
First, prepare your java.sql.CallableStatement using java.sql.CallableStatement cStmt = java.sql.Connection.prepareCall({ call G(?, ?) });
Note that you don't have to use the OracleCallableStatement. The java.sql.CallableStatement will work just fine.
For the IN parameter, you need to create three TEST_TYPE objects. Then you need to create one TESTTYPE1 object.
These will all be instances of oracle.sql.STRUCT.
To create a oracle.sql.STRUCT object you need a descriptor and a set of attributes. For example, to create a TEST_TYPE object you would do the following
1. StructDescriptor sd = StructDescriptor.createDescriptor("TEST_TYPE", java.sql.Connection).
2. Add a VARCHAR2 attribute to an array of attributes (e.g. Object[] attributes = new Object[]{"Student Name"})
3. oracle.sql.STRUCT struct = new oracle.sql.STRUCT(sd, java.sql.Connection, attributes)
Then do something similar to create the TESTTYPE1 object, except that the attribute array will contain three instances of TEST_TYPE struct objects.
To bind the IN parameter you need to use the java.sql.CallableStatement.setObject(1, <Instance of TESTTYPE1 object>).
To register the OUT parameter, you need to call java.sql.CallableStatement.registerOutParameter(2, oracle.jdbc.OracleTypes.STRUCT, "RECT").
Then, execute your procedure using cStmt.execute();
Retrieve your OUT parameter using oracle.sql.STRUCT struct = (oracle.sql.STRUCT)cStmt.getObject(2).
Once you've done that, to get the values of the attributes of all of your STRUCT objects, you need their descriptors and their metadata.
Maybe you are looking for
-
my ipad says not enough storage and it cannot be backed up. has choice to close or go to settings, it will not do either. It is locked up
-
Healing brush tool at lines of high contrast
I love the healing brush tool but hate how it doesn't work right in the proximity of high contrast areas. It leaves that little light or dark halo. Can anyone tell me why/how/solutions as to why it does this? I know bumping up the hardness works a li
-
Interactive Report - Aggregate Calculations
How can I get a variance or stddev calculation in an interactive report? This should function exactly the same as a sum or average aggregation. As I don't see a way to do it with the interface, and at the very least, I am hoping someone can help with
-
All My Files doesnt show all the files on the computer
All My Files didn's show all the files on the Computer. I downloaded Mountain Lion yesterday. After the download, it began to show all the files. Now again from this morning, it doesn't show all the files. It shows only a few word docs and nothing el
-
Mac to mac problem, USA to Germany
I have a powerbook G4 (10.3.9) trying to do ichat with an ibook (10.4) in Germany. We have had no problems in the past, but now we can't connect (we try and it "rings" but either says one of us won't accept the "call" or is busy). It has worked fine