How to run a stored procedure from sqlplus
scehma name: aa
package name: bb
procedure name : cc
I run the procedure from sql plus like this...
execute aa.bb.cc
I got error " not defined procedure" any one knows why? thanks!
Based on the information you provided:
1. You are not connected as Schema aa
2. Schema aa has not granted permission to you to execute package bb.
To resolve this issue:
Connect as schema aa
execute following statement:
Grant execute on bb to Your_userName;connect as Your_userName
On SQL*Plus prompt now you can execute this procedure using:
execute aa.bb.cc;Assuming there is no parameter for procedure cc.
You can create synoyms also to avoid specifying "aa".
Thanks,
Dharmesh Patel
Similar Messages
-
How to edit stored procedure from sqlplus ?
Hi,
Can anyone advise how to edit stored procedure from sqlplus ?
Many thanks.You can get the source for an object from SQL*Plus by querying the user_source table, i.e.
SQL> create procedure foo
2 as
3 begin
4 dbms_output.put_line( 'foo' );
5 end;
6 /
Procedure created.
SQL> select text
2 from user_source
3 where name = 'FOO'
4 order by line;
TEXT
procedure foo
as
begin
dbms_output.put_line( 'foo' );
end;Most commonly, though, if you are using SQL*Plus and a text editor to develop stored procedures, you will have all your stored procedures in .sql files that you edit and just use SQL*Plus to create (or recreate) the stored procedures.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
How to call a stored procedure from WorkShop
Hello Everyone .. I'm quite new with WebLogic 8.1 & WorkShop, so please bare with
me .. Today I'm simply trying to find out how to call a stored procedure from
within workshop, using any of the DB Controls .. I see workshop provides a way
create a Java Control, Rowset Control, but it wont easily allow for a stored procedured
to be entered in place of the inline query .. Perhaps I've over looked it. Any
advise on the best way to tackle this task will be appreciated.
AtahualpaAtahualpa--
Maybe this will help:
http://edocs.bea.com/workshop/docs81/doc/en/workshop/guide/controls/database/conStoredProcedures.html
Eddie
Atahualpa wrote:
Hello Everyone .. I'm quite new with WebLogic 8.1 & WorkShop, so please bare with
me .. Today I'm simply trying to find out how to call a stored procedure from
within workshop, using any of the DB Controls .. I see workshop provides a way
create a Java Control, Rowset Control, but it wont easily allow for a stored procedured
to be entered in place of the inline query .. Perhaps I've over looked it. Any
advise on the best way to tackle this task will be appreciated.
Atahualpa -
How to call a stored procedure from EJB3/toplink essentials..?
Hi,
I want to call a stored procedure residing in the oracle 10 g Database from my application's data access layer, which is designed using EJB3/toplink essentials.
I think this feature is not available right now in the EJB3 spec...any workaround with code if possible will be very help full...
Thanks & Regards,
SarveshThis should help you....
how to execute a stored procedure from ejb3.0 bean using entity manager -
How to create java stored procedure from oracle(Dastageer)
how to create java stored procedure from oracle-please help me to create the procedure.
Hi,
This forum is exclusively for discussions related to Sun Java Studio Creator. Please post your question in the appropriate forum.
Thanks,
RK. -
How to call multiple stored procedure from same DB Adapter
Hi,
I want to invoke 3 stored procedures from my message flow in BUS . I created a DB adapter and invoked 1 successfully . Now I don't to configure 2 other DB adapters for calling other 2 stored procedures . I want some how to be able to call the other 2 from the first DB adapter only . Somehow I need the flexibility to have procedure names as the operation names in 1 wsdl and be able to configure this in JDeveloper for this at time of DB adapter configuration . I am using 11G . Is it possible ?You can probably create a DB adapter with operation type selected as Execute Pure SQL and write SQL code to invoke the stored procedures depending on the procedure name (which you can get as one of the parameters of DB Adapter).
However, Even if you were able to do it, the DB Adapter schemas are generated based on stored procedure parameter list and types. If you use Execute Pure SQL type of DB Adapter the schema will be generated based on the parameters which you are using in your custom SQL code within DB Adapter. Which means that if you want to add a new stored procedure as target which has a different name and different parameters then you will need to regenerate the DB adapter and update your custom SQL code. This also means that you will need to do regression testing interfaces to all stored procedures whenever there is any change in this DBAdapter.
Now, my question is why do you want to invoke multiple stored procedures from same DB adapter?
This is not a good way to design integration solutions and makes your services resistance to change as it will take more time to change and test.
If all that you want is to have a web service which can have different operations for different stored procedures then you should create three business services and create a wrapper proxy service which has one operation for each stored procedure, within the proxy transform and call the correct backend service (you can use operational branch). This way you have a modular code where each module (read interface to one stored procedure) can be independently modified and tested. -
How to invoke DB stored procedures from EJB3.0
In our project we are using EJB3.0.
I got one situation, where i need to call a db stored procedure through my code. But i couldn't find any possibilities.
Can any body help me in this regard
Thanks in advance
KiranHi,
As per ejb3.0 spec is conserned it doesnt specify anything with regard to stored procedures as of now, it means ejb3.0 cannot handle stored procedures as of now, of course it still depends on vendor implemenation u can check out for any possibilities wether vendor provides support for it or not, as for as i am conserned they dont as of now.
Possible Alternative:
This can be achived only through BMT using 2 transactions.
Open a seperate JDBC managed Transaction(by setting AutoCommit to false) execute the stored procedures from here, u can commit or roll back from there on.
Thanks and Regards
Srikanth S -
How to view a stored procedure from sql plus
Can anyone please tell what is the command for viewing the content of the stored procedure from sql plus ?
ThanksHi,
I use this simple script to retrieve.......
EDTRAD@T_E_S_9-->l
1 select text from all_source where name = 'GET_MAN' -- proc name here
2* order by line asc
EDTRAD@T_E_S_9-->/
TEXT
FUNCTION get_man (in_man SSBOSS.CLNTWORK.manager%type)
RETURN varchar2 IS
CURSOR get_man(in_man SSBOSS.CLNTWORK.manager%type) IS
SELECT name
FROM ssboss.clntwork
WHERE agency = 'TM'
AND manager = in_man
AND manager is not null
AND manager != '**OB**';
v_man SSBOSS.CLNTWORK.name%type := null;
BEGIN
OPEN get_man(in_man);
FETCH get_man INTO v_man;
IF get_man%notfound THEN
v_man := 'Manager Not Found !';
RETURN (v_man);
CLOSE get_man;
END IF;
RETURN (v_man);
CLOSE get_man;
END;
21 rows selected.
EDTRAD@T_E_S_9--> -
How to execute an stored procedure from the Report Region
Have stored procedure "LER_KRONOS_PAYCODE_HOURS_P" compiled and ready.
(previously tested)
Region Source:
DECLARE
v_SITE_ID VARCHAR2(8);
v_SDATE VARCHAR2(8);
v_EDATE VARCHAR2(8);
v_LEVEL3 VARCHAR2(60);
BEGIN
v_SITE_ID :=P4_SITES_LOV;
v_SDATE :=P4_SDATE;
v_EDATE :=P4_SEDATE;
v_LEVEL3 :=P4_LEVEL3;
EXECUTE LER_KRONOS_PAYCODE_HOURS_P(v_SITE_ID,v_SDATE,v_EDATE,v_LEVEL3);
END;
Error When run the page:
ORA-06550: line 11, column 12: PLS-00103: Encountered the symbol "LER_KRONOS_PAYCODE_HOURS_P" when expecting one of the following: := . ( @ % ; immediate The symbol ":=" was substituted for "LER_KRONOS_PAYCODE_HOURS_P" to continue.You need the execute keyword only when you run it directly from sqlplus.. that will tell sqlplus to append the keyword begin and end after the procedure call.
Example.
SQL > exec proc1 (input1);
will tell sqlplus to run it as a block.. saying
sql> Begin
proc1(input1);
end;Inside the procedure , in your code, you dont need the execute keyword.
But, why do you want to execute a procedure inside the source for a report region..? -
How to run a stored procedure in TOAD
Hello,
I created a simple stored procedure in the procedure editor in TOAD. It's just a simple 'Hello World' output statement. Here is the code:
create or replace procedure new_proc is
greetings varchar2(20);
begin
greetings := 'Hello World';
dbms_output.put_line(greetings);
end;
The procedure created fine, but when I try to call it in the procedure editor or in the SQL Editor, both tools act as if the procedure cannot be found, and I get an error message.
In SQL Editor, I type in:
exec new_proc;
and it says that "new_proc" is invalid.
Does anyone know how to run this procedure in TOAD?
Thanks,
Peter
Message was edited by:
P. SwansonDon't know about TOAD but this is how it is in SQL*Plus.
SQL> create or replace procedure new_proc is
2 greetings varchar2(20);
3 begin
4 greetings := 'Hello World';
5 dbms_output.put_line(greetings);
6 end;
7 /
Procedure created.
SQL> set serveroutput on
SQL>
SQL> exec new_proc ;
Hello World
PL/SQL procedure successfully completed.
SQL>Message was edited by:
Kamal Kishore -
How to run a stored procedure in TOAD 9.0
Dear Friends,
I am using TOAD 9.0 .
Running a procedure but getting the error ..
create or replace PROCEDURE UPD_TBL(I_table_name IN VARCHAR2) IS
CURSOR c_columns is select column_name from ALL_TAB_COLUMNS where
TABLE_NAME = I_table_name;
BEGIN
FOR rec in c_columns
LOOP
IF ( rec.COLUMN_NAME = 'X_NNM_TYPE_CD' ) THEN
UPDATE I_table_name set X_NNM_TYPE_CD = REPLACE (X_NNM_TYPE_CD, '-', '_')
WHERE INSTR (X_NNM_TYPE_CD, '-') > 0 ;
ELSIF ( rec.COLUMN_NAME = 'X_REVENUE_TYPE_CD' ) THEN
UPDATE I_table_name set X_REVENUE_TYPE_CD = REPLACE (X_REVENUE_TYPE_CD, '-', '_')
WHERE INSTR (X_REVENUE_TYPE_CD, '-') > 0 ;
END IF;
END LOOP;
EXCEPTION
when OTHERS then
NULL;
END UPD_TBL;
ERROR: TABLE OR VIEW DOES NOT EXIST.
Please let me know how to run the procedure in toad.
thanks/kumarKumar,
At a minimum, you would need to remove both the exception handler in your procedure and the exception handler in your anonymous block. As has been mentioned before, the code
EXCEPTION
WHEN OTHERS THEN
NULL;
END;is almost always a bug. In your case, your code is almost certainly generating an exception and your exception handler is silently catching and ignoring that exception. If you care whether or not any rows are updated, that is a bug.
Once you remove the exception handlers, you'll very likely discover that the SQL statements you are generating and executing dynamically are malformed. Off the top of my head, it would appear that there is no space between the table name and the SET keyword in the string you are constructing. That means that if I_TABLE_NAME is 'EMP', for example, you'd construct a statement like
UPDATE empSET x_nnm_typ_cd = ...'Oracle would interpret empSET as the table name, it would interpret X_NNM_TYP_CD as a table alias, and then it would encounter the equals sign unexpectedly and generate a syntax error. You'd need to insert a space after the table name and before the SET keyword (note where folks inserted extra spaces in their sample code).
In general, you are probably better served by having a local variable that you use to build up the SQL statement. That way, you can print (or log) the SQL statement that is constructed. When you encounter a syntax error at runtime, that will generally make debugging easier. So you'd probably want something like
l_sql_stmt VARCHAR2(1000);
BEGIN
FOR rec IN cur_c_columns LOOP
IF (rec.column_name = 'X_NNM_TYPE_CD') THEN
l_sql_stmt :=
'UPDATE '||i_table_name||
' SET x_nnm_type_cd = REPLACE(x_nnm_type_cd, ''-'', ''_'')'||
'WHERE INSTR(x_nnm_type_cd, ''-'') > 0';
dbms_output.put_line( l_sql_stmt );
EXECUTE IMMEDIATE l_sql_stmt;
...When you get a syntax error, you can then take a look at the SQL statement that was generated and debug the problem more easily.
Justin -
How to call a stored procedure from servlet?
Hi all
We are developing a project in servlet which needs to call a stored procedure in oracle 8i database.How to make a call? Whether can i get any data from the database using STORED PROCEDURE
THANKS IN ADVANCE
kamalakannanHello,
You can do an HTTP call from a store procedure using thre UTL_HTTP package; so you should be able to call your servlet this way.
See UTL_HTTP documentation
Regards
Tugdual Grall -
How to run oracle stored procedure dynamically
How can I call a stored procedure dynamically. My requirement is to call a stored procedure based on user selection on a parameter screen. I do not want to hardcode proocedure name, but rather call dynamically.
If I use the same methodology as of running dynamic sql's Iam getting an error.
"invalid SQL statement after call to procedure"
v_cursorid INTEGER;
v_cnt NUMBER;
v_sqlstring VARCHAR2(2000);
v_sqlstring := 'execute insert_job_status('''||TO_CHAR(SYSDATE,
'dd-mon-yyyy HH:mi:ss')||''');';
v_cursorid := dbms_sql.open_cursor;
dbms_sql.parse(v_cursorid, v_sqlstring, dbms_sql.v7);
--cnt := dbms_sql.execute(v_cursorid);
dbms_sql.close_cursor(v_cursorid);EXECUTE is a SQL*Plus command. try
v_sqlstring := 'begin insert_job_status('''||TO_CHAR(SYSDATE,
'dd-mon-yyyy HH:mi:ss')||'''); end;';Cheers, APC -
How to call a stored procedure from my JSP?
Hi to all,
I have a very simple jsp page and a simple sql server stored procedure!
I need to call this stored procedure by passing two parameters.
My result set will have 4 columns.
I would really appreciate any input on how to issue this call to a SP.
I am new to JSP.
Regards,
Sam
Sam,
BEA provides examples that are shipped with the product under
<beahome>\weblogic700\samples\server\src\examples\
Look at the jsp directory for JSP examples that access a database and look at
say the jdbc\oracle\storedprocs.java for an example of java code calling out to
a stored procedure - - by combining one of the jsp database examples with this
stored procedure example you should be 'good to go'
Chuck Nelson
DRE
BEA Technical Support
-
How to call a Stored procedure from xsodata service?
Hi Everyone,
I have created an stored procedure and I'm trying to consume this store procedure from xsodata service.
But unable to activate the service because of an error.
Invalid procedure or parameter list in procedure "package.WebContent.src.hana.procedures::PROCEDURE
I have activated both store procedure as well as attribute view.
Here is my stored procedure.
PROCEDURE "SCHEMA"."package.WebContent.src.hana.procedures::PROCEDURE" (
IN row "SCHEMA"."package.tables::object" )
LANGUAGE SQLSCRIPT
SQL SECURITY INVOKER AS
--DEFAULT SCHEMA <default_schema_name>
--READS SQL DATA AS
BEGIN
Write your procedure logic
declare shortdesc string;
SELECT SHORT_DESCRIPTION INTO shortdesc FROM :row;
END;
Service:
service namespace "package.WebContent.src.hana.service"{
"package/OBJECT.attributeview" as "OBJECTS"
key ("OBJECT_ID")
create using "package.WebContent.src.hana.procedures::PROCEDURE";
Is there anything wrong in the way i'm calling the procedure??Hi Arjun,
You can expose the procedure as an Odata Service if you wrap it in a Scripted Calculation View..
Firstly You will have to create a Scripted Calculation View from the Modeller perspective.
Below is an example I just tried.
Add Columns & Input Parameters
Consume this Calc View in your Odata service :
service namespace "services.test"
"pda.Models::CV_TEST" as "Customer"
keys generate local "ID"
parameters via entity;
Check your service by Passing the Input Parameters
http://<host>:<port>/<>/services/test.xsodata/CustomerParameters(2)/Results?$format=json
Hope this was Helpful
Regards,
Avinash Raju
Maybe you are looking for
-
Are all the pictures in Events in the master photos? Are they duplicates?
Are all the pictures in Events in the master photos? Are they duplicates? I need to clean up my events list.
-
Spreadsheet can't be imported.
Spreadsheet can't be imported. The document was created with an unsupported application version. I only keep 6 of my most used spreadsheets in iCloud at the moment. Yesterday, out of the middle of nowhere I have received the message above when I try
-
Does the portal utilizes Internet Explorer's ADODB.Stream object?
Does the portal utilizes Internet Explorer's ADODB.Stream object? We're attempting to understand the impact associated with disabling the ADODB.Stream object within Internet Explorer as recommended by Microsoft - http://support.microsoft.com/default.
-
Hi, I'm using BIEE11.1.1.6. then I faced a problem about BIP security. I using init session block to control user login to BIEE. there users stored in db can login BIEE,but can't login BIP. one user has BIAdministrator role also can't login BIP. then
-
How do I fix issue with no sim installed on ipad2?
All of sudden my ipad2 64gb reported it has No Sim installed. Have tried various suggestions, any new ideas?