How execute this stored procedure from SQL PLUS???
Hello folks....
Help me please...
I have this procedure....
CREATE OR REPLACE PROCEDURE TEST(COD OUT VARCHAR2, NUM OUT
VARCHAR2, ID OUT VARCHAR2)
AS
BEGIN
END;
SO, I4D LIKE TO EXECUTE IT FROM SQL PLUS::
BUT, I DONT KNOW HOW TO DO..PLEASE SEND ME A SAMPLE..
THANK U
Thank u man!!!
look, my error before was :
SQL> set serveroutput on
SQL> declare
SQL> cod varchar2(100);
SQL> num varchar2(100);
SQL> id varchar2(100);
SQL> begin
SQL> TEST( cod, num, id );
SQL> EXEC DBMS_OUTPUT.put_line( cod || ' ' || num || ' ' ||
id );
SQL> end;
SQL> /
i put the EXEC....
thank u!!!
Similar Messages
-
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 compile a procedure from Sql*Plus?
Dear friends,
I couldnt find the way how to compile my invalid procedure through sql*Plus.
I know this is very awkward,but I m in need of that command only.
Thanks
Ritesh SharmaPls check it --
SQL>
SQL>
SQL> @C:\RND\Oracle\Function\a.sql;
11 /
Function created.
SQL>
SQL>
SQL> start C:\RND\Oracle\Function\a.sql;
11 /
Function created.
SQL> Regards.
Satyaki De. -
How to execute the parametered stored procedure in sql *plus ?
how to execute the parametered stored procedure in sql *plus ?
my storedprocedure format
CREATE OR REPLACE PROCEDURE SMS_SELECTMPLOYEE
(empDOB out date, empEmpName out varchar2)
thanks & regards
mk_murOh, sorry... making many reading-too-fast mistakes today...
You can't declare date variables in SQL*Plus (seel help var), but you can cast to varchar2:
TEST> CREATE OR REPLACE PROCEDURE SMS_SELECTMPLOYEE (empDOB out date, empEmpName out varchar2) IS
2 d date := sysdate;
3 e varchar2(10) := 'bob';
4 begin
5 empdob := d;
6 empempname := e;
7 end;
8 /
Procedure created.
TEST> var d varchar2(30)
TEST> var n varchar2(30)
TEST> call SMS_SELECTMPLOYEE(:d,:n);
Call completed.
TEST> print d n
D
11/07/06
N
bobYoann. -
How to call stored procedure from Pro*C
How to call stored procedure from Pro*C ?
my system spec is SuSE Linux 9.1, gcc version : 3.3.3, oracle : 10g
my Pro*C code is the following..
EXEC SQL EXECUTE
begin
test_procedure();
end;
END-EXEC;
the test_procedure() has a simple update statement. and it works well in SQL Plus consol. but in Pro*C, there is a precompile error.
will anybody help me what is the problem ??I'm in the process of moving C files (with embedded SQL, .PC files) from Unix to Linux. One program I was trying to compile had this piece of code that called an Oracle function (a standalone), which compiled on Unix, but gives errors on Linux:
EXEC SQL EXECUTE
BEGIN
:r_stat := TESTSPEC.WEATHER_CHECK();
END;
END-EXEC;
A call similar to this is in another .PC file which compiled on Linux with no problem. Here is what the ".lis" file had:
Pro*C/C++: Release 10.2.0.1.0 - Production on Mon Jun 12 09:26:08 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Error at line 193, column 5 in file weather_check.pc
193 BEGIN
193 ....1
193 PCC-S-02346, PL/SQL found semantic errors
Error at line 194, column 8 in file weather_check.pc
194 :r_stat := TESTSPEC.WEATHER_CHECK();
194 .......1
194 PLS-S-00000, Statement ignored
Error at line 194, column 18 in file weather_check.pc
194 :r_stat := TESTSPEC.WEATHER_CHECK();
194 .................1
194 PLS-S-00201, identifier 'TESTSPEC.WEATHER_CHECK' must be declared
Pro*C/C++: Release 10.2.0.1.0 - Production on Mon Jun 12 09:26:08 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
System default option values taken from: /oracle_client/product/v10r2/precomp/ad
min/pcscfg.cfg
Error at line 194, column 18 in file weather_check.pc
:r_stat := TESTSPEC.WEATHER_CHECK();
.................1
PLS-S-00201, identifier 'TESTSPEC.WEATHER_CHECK' must be declared
Error at line 194, column 8 in file weather_check.pc
:r_stat := TESTSPEC.WEATHER_CHECK();
.......1
PLS-S-00000, Statement ignored
Semantic error at line 193, column 5, file weather_check.pc:
BEGIN
....1
PCC-S-02346, PL/SQL found semantic errors -
Error while executing a stored procedure from forms6i
When I execute a STORED PROCEDURE from ORACLE DB 10g this procedure works perfectly fine.
But when I execute the same from the FORMs 6i I get the following error:
PDE-PLU022 Don't have access to the stored program unit
XMLPARSERCOVER in schema CARE.
where XMLPARSERCOVER is the class and
CARE is the schema.
Regards,
Jignesh SI have tried this with both the owner of the schema and the intended user, -from both forms and directly.
All rights was granted on the stored procedure. Since posting I have found that one of the tables that the procedure might insert into, was not explicitly granted to the intended user, and after rectifying that the error message went away.
-however, the procedure now silently "finishes" without any evidence that it ever ran, if invoked from the forms application. When invoked from SQL Plus (or JDev, or Toad) it runs as expected.
I have no public synonym for the procedure, -is that necessary?
The stored procedure in question is implemented in java, and published as a stored procedure. It does rather heavy lifting, when running, using a view against another server , updating local tables and quite a lot of data validation/cleansing, and logging. All recourses are within the same schema.
Any ideas? -
Execute a stored procedure from a JSP.(Help...)
How can I execute a stored procedure from a JSP.
Wich tags I need to use ???
I'm using the oracle thin JDBC.
please help me.
null<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Mario Bellido ([email protected]):
How can I execute a stored procedure from a JSP.
Wich tags I need to use ???
I'm using the oracle thin JDBC.
please help me.<HR></BLOCKQUOTE>
I just try a simple call with a data tag just like this (see category.jsp in the onlineorder example provided with Jdev 3.2.3):
<!-- Tutorial - ApplicationModule Tag -->
<%@ taglib uri="/webapp/DataTags.tld" prefix="jbo" %>
<jbo:ApplicationModule configname="OnlineOrders.OnlineOrdersModule.LocalConfig" id="OnlineOrdersModule" username="BC4J" password="BC4J" />
<!-- Tutorial - DataSource Tag -->
<jbo:DataSource id="category" appid="OnlineOrdersModule" viewobject="CategoryView" ></jbo:DataSource>
<jbo:ExecuteSQL appid="OnlineOrdersModule" >
insert into tablejsp values ('testtable')
</jbo:ExecuteSQL>
<jbo:ExecuteSQL appid="OnlineOrdersModule" >
call testjsp()
</jbo:ExecuteSQL>
<jbo:Commit appid="OnlineOrdersModule" />
testjsp is a stored PL/SQL procedure without arguments.
null -
Testing stored procedure using sql plus
I'm attempt to create and test a stored procedure in sql plus.
I enter:
create procedure sp_getconfiguration(mygroup in char, myparameter in char, myvalue in out char) as begin select configvalue into myvalue from tblconfiguration where configgroup = mygroup and configparameter = myparameter; end;/
I get a procedure created. response by when I type:
variable myval char
call sp_getconfiguration('Language','Enabled', myval);
I get the following error:
error at line 1:
ora-06576: not a valid function or procedure name
I can go into DBA studio and see the procedure listed and can compile it and it says "valid". I have tried granting execute permission to public and trying it again under sql plus and nothing seems to help.
I'm also attempting to run this same procedure from VB and get an invalid column name error from there.
Thanks for any help in advance.
LeeThanks for all your help. What I actually called product support and they helped me solve it. But what I found out is that if using oracle 8.1.# you have to invoke the stored procedure without the "call " in front of the procedure name. For instance.
sp_getconfiguation()
In version 9.# it appears that you use the call in front of the procedure. Dah! So if anyone else is having this problem. That is the solution. Thanks anyway. -
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 -
Error ORA-04031 while executing a stored procedure from Pro C++ code
I am getting the error ORA-04031(Unable to allocate 4096 bytes of shared memory("Shared Pool",.....)) while trying to execute a stored procedure from my pro*C application. This happens only after a few hours since the application has been running. I am closing the cursor after every database call.
Does anyone know why it is happening and any possible solutions?
TIA
Srithaj.One thing that can be done is to flush the shared pool before starting the application.
alter system flush shared pool;
Another is to increase the shared pool size by setting the parameter shared_pool_size in init_sid.ora file.
null -
How to modify stored procedures in SQL Azure database in SQL server express 2012
Hi,
I want to modify stored procedures in SQL Azure database in SQL Server Express 2012. But when right click on the stored procedure in Object Explorer, there is no option "Modify" as for SQL Server database. I wonder how to modify stored procedures in SQL
Azure database in SQL Server Express 2012. Thanks.
YorkHi,
Not sure whay there is no modify..
As a workaround can you try this and see if you can modify proc..
Script Procedure As-> Alter To->New query window..
- Chintak (My Blog) -
Error while executing Multiple Stored Procedure through .sql file
Hi Guru's.
I am new to ORACLE. I am facing problem while creating Stored Procedure through .sql file.
I have one test.sql file with Stored Procedure is like,
CREATE OR REPLACE PROCEDURE skeleton1
AS
BEGIN
DBMS_Output.Put_Line('skeleton1');
END skeleton1;
CREATE OR REPLACE PROCEDURE skeleton2
AS
BEGIN
DBMS_Output.Put_Line('skeleton2');
END skeleton2;
Now when i try to execute this test.sql file through SQL PLUS it gives me Error like this
I am opening test.sql file from SQL PLUS,
SQL>
1 CREATE OR REPLACE PROCEDURE skeleton1
2 AS
3 BEGIN
4 DBMS_Output.Put_Line('skeleton1');
5 END skeleton1;
6 /
7 CREATE OR REPLACE PROCEDURE skeleton2
8 AS
9 BEGIN
10 DBMS_Output.Put_Line('skeleton2');
11* END skeleton2;
SQL> /
Warning: Procedure created with compilation errors.
SQL> show errors;
Errors for PROCEDURE SKELETON1:
LINE/COL ERROR
6/1 PLS-00103: Encountered the symbol "/"
SQL>
Please suggest how to create multiple CREATE PROCEDURE using single .sql script file....
Regards,
ShatrughanHi,
Try this
CREATE OR REPLACE PROCEDURE skeleton1
AS
BEGIN
DBMS_Output.Put_Line('skeleton1');
END ;
CREATE OR REPLACE PROCEDURE skeleton2
AS
BEGIN
DBMS_Output.Put_Line('skeleton2');
END;
/Save the file and call it.
Regards,
Bhushan -
Need urgent help - how to call a procedure from sql returning a rowset
Hello,
I need to send a SQL Query from a VB application to let it execute on the oracle DB. This query needs to call a procedure/function, which returns a resultsets, so that i can to a (Where x in ( <call procedure> )). Would result in Where x in (50,100,3094).
Is this possible in oracle, and how?
Thanks.
Daniel MeyerHi Daniel,
I had a similiar problem yesterday.
Thanks to the nice people in this forum I was able to figured that out.
So here is a PL/SQL Oracle 9i code for your reference.
You can create and test it using the SQL Plus console.
I used this stored procedure in my VB .NET and worked fine!
I am enclosing the VB code in this reply as well.
One last note: in order to test it in the VS .NET, don't forget to download the Oracle ODP driver for .NET
Good luck!
Amintas
create or replace package pkg_emp
AS
type rc_emp is ref cursor;
end;
create or replace
procedure SP_GetEmpData(v_empno IN emp.empno%Type,
v_ename IN emp.ename%Type,
emp_cur OUT pkg_emp.rc_emp)
is
begin
if v_empno is not null and v_ename is null then
OPEN emp_cur for
select empno,ename,sal
from emp
where empno=v_empno;
elsif v_ename is not null and v_empno is null then
OPEN emp_cur for
select empno,ename,sal
from emp
where ename like v_ename ||'%';
end if;
end;
/* Testing the stored procedure */
/*#1 */
var myresultset refcursor;
execute SP_GetEmpData(7900,null,:myresultset);
print myresultset;
/*#2 */
var myresultset refcursor;
execute SP_GetEmpData(null,'A',:myresultset);
print myresultset;
-x-x-x-x-x-x-x-x-x VB .NET CODE x-x-x-x-x-x-x-xx-x-
Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProcurar.Click
Dim dr As Oracle.DataAccess.Client.OracleDataReader
Try
If txtEmpNo.Text <> "" Then
dr = GetData(CInt(Val(txtEmpNo.Text)), "")
Else
dr = GetData(0, UCase(txtEname.Text))
End If
txtEmpNo.Text = ""
txtEname.Text = ""
Catch ex As Exception
Response.Write(ex)
End Try
drgTest.DataSource = dr
drgTest.DataBind()
End Sub
Private Function GetData(ByVal v_empno As Integer, ByVal v_ename As String) As Oracle.DataAccess.Client.OracleDataReader
Dim cn As New Oracle.DataAccess.Client.OracleConnection(ConfigurationSettings.AppSettings("ConnectionString"))
Dim cmd As New Oracle.DataAccess.Client.OracleCommand
Dim dr As Oracle.DataAccess.Client.OracleDataReader
cmd.Connection = cn
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "SP_GetEmpData"
cmd.Parameters.Add("v_empno", Oracle.DataAccess.Client.OracleDbType.Int32).Value = IIf(v_empno = 0, System.DBNull.Value, v_empno)
cmd.Parameters.Add("v_ename", Oracle.DataAccess.Client.OracleDbType.Varchar2, 40).Value = IIf(v_ename = "", System.DBNull.Value, v_ename)
cmd.Parameters.Add("rc_emp", Oracle.DataAccess.Client.OracleDbType.RefCursor).Direction = ParameterDirection.Output
Try
cn.Open()
dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
Catch ex As Exception
Throw ex
Exit Function
End Try
Return dr
End Function -
Incorrect Update Count by executing a stored procedure from Java
Hi Guys,
I am calling a stored procedure from the java program which is modifying the rows of a table. Now I want to know how many rows have been modified by executing the stored procedure. I am writing the following code for the purpose:
OracleCallableStatement stmt =
(oracle.jdbc.driver.OracleCallableStatement)con.prepareCall("{callsp_um_setForumID(?,?)}");
stmt.setInt(1,101);
stmt.setInt(2,666);
n = stmt.executeUpdate();
System.out.println(n + " row(s) updated");
This procedure is actually modifying the table(When I query the databse it has modified 1 row). But it is returning a value 0 and is printing "0 row(s) updated".
Is there a way by which I can find out the number of rows updated by executing the stored procedure?
Thanks
Sachin
[email protected]I'm no expert on this, but I have a similar call where I fetch
an Oracle REF CURSOR from a call to a stored function. If you
fetch the cursor as an Object from your CallableStatement, you
can then cast it to a ResultSet e.g.
mystatement.executeUpdate();
ResultSet rs = (ResultSet) mystatement.getObject(1);
Then you should be able to loop through your ResultSet as usual.
Good luck!
Chris -
How to Call a Procedure from SQL ?
Hi All,
I've a procedure defined like the below taking IN/OUT parameters as table type.
PROCEDURE "SAP_HANA_DEMO"."usersCreateMethod" (IN row "SAP_HANA_DEMO"."User.Details",
OUT error "SAP_HANA_DEMO"."EPM.Procedures.tt_errors")
Now, how do i call it from SQL ?
I'm trying to call it like
CALL "SAP_HANA_DEMO"."usersCreateMethod"('my_global_table','?');
It says
Could not execute 'CALL "SAP_HANA_DEMO"."sap.hana.democontent.epm.Procedures::usersCreateMethod"('my_global_table','?')'
SAP DBTech JDBC: [1288]: expression cannot be used as an assignment target: '?': line 1 col 97 (at pos 96)
Thanks & Regards
SakthivelHi ,
You should call like this
Define a variable of your table type.
Define ErrorMessage SAP_HANA_DEMO"."EPM.Procedures.tt_errors"
CALL "SAP_HANA_DEMO"."usersCreateMethod"('my_global_table',ErrorMessage);
Regards,
Krishna Tangudu
Maybe you are looking for
-
ABAP RUNTIME ERROR WHILE RUNNING BSEG REPORTS
hi Exports I've developed one report using bseg (G/L Account Balance) report but following error occured while giving some G/L account no. bbos those GL account contains lot of records in bseg? how can i fine tuning the report both system and program
-
How to pass the page item data from tabA to TabB of a discoverer report
I have a discoverer repoort, it is master_detail (Dept-Emp) report TabA is a master worksheet, which has a page item Deptno (the data is from a customized query) TabB is detail report which has a Deptno as the page item which show the emp detail info
-
We are attempting to use Application Insights (v0.12.0-build17386) for our Windows Store App. When we use TelemetryClient.TrackException, no details appear in the azure portal. The Failed Method is "Could Not Parse" and the Call Stack is empty. If
-
Why SQL services is dont start in configuration manager studio 2012
I finished installing SQL server Management Studio 2012 and that of configuration management studio. When I wanted to log in did not find server name, and I tried <pc name>\SQLEXpress, still did not work. So checked configuration management studio an
-
Hello all Can any one tell me in Which DB tables ABAP Results will be stored? Thanks Oli