Passing a CLOB data to a procedure as an input parameter
Hi All,
I have a procedure to which I am passing a value as CLOB datatype. It works fine when the size of data is less than 4000 char. but in case the size is greater than 4000 characters, the procedure is throwing error.
Please help me to handle this error.
Create or Replace Procedure Test ( inp_str IN CLOB)
AS
a number;
b number;
str clob;
Begin
Begin
a:= 1;
Select INSTR(inp_str, 'var', a) into b from dual;
END;
Begin
End;
Insert into table_name values (b);
Exception
End;
exec test ('abcmndk.......................................................................................10000char');
This is the sample code. It is working fine and inserting data into table when the size of inp_str is less than or equal to 4000 char. But, when the size of inp_str is huge (>4000) then the procedure is not getting executed and its throwing error for the string passed as parameter.
Thanks in advance,
Gaurav
Edited by: 787203 on Dec 10, 2010 1:01 PM
Nobody can guess what your are doing and what error you are facing. You need to provide more details, like the code, calling method and the exact error message.
Use tag to post your code.
Similar Messages
-
Creating a job for a procedure with an input parameter
Hi,
I want to create a job for a procedure ( sp_proc ) with a input parameter.
The input parameter is a date value.
As per the syntax for dbms_job.submit procedure;
dbms_job.submit (
job IN BINARY_INTEGER,
what IN VARCHAR2,
next_date IN DATE,
interval IN VARCHAR2 DEFAULT 'NULL',
no_parse IN BOOLEAN DEFAULT FALSE);
How should the procedure be declared in the 'what' parameter of the dbms_job.submit procedure ?
Please guide.
Thanks.Hi,
You are wright, I have found this thread [DBMS_JOB -- how to pass parameters to the job|http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:351033761220].
Regards, -
Fetch Data from an Object which is Input parameter to a BADI
Hi all,
This is a requirement in a BADI. The BADI is triggered by some program and the BADI has an Object ct_valid_lanes as an Input Parameter.
The Object ct_valid_lanes is of type "ANY TABLE". By debugging, I found out that it has many fields say MATNR, MATID, LOCNO etc etc..and has more than one data for each field.
I want to fetch these data from the object and put it into my internal table. I can't loop at an object and also I don't know how to read fields in an object. I am new to OOPS concept. Kindly, help.
Regards,
PreethaHi,
I have done that using Field-Symbols.
Thanks,
Preetha -
Extracting Multiple Table Data Dynamically..Table is an Input parameter
Hi All
Can any one update the Program/design of extracting multiple table data as a list or to an excel sheet
For eg:- Mutliple Tables are entered in selection screen and upon executing the output should be to an excel sheet sequenctially according to the table names entered in the selection screen
Awaiting for your update
Regards
Shiva
Edited by: shivakumar bandari on May 29, 2009 9:35 PMHI Naimes
Thanks for youe reply
your second step says to select data from 'table' here tables are dynamic in nature I mean they are an input parameters..how can I write select on a table..
I can get the table existence from DD02L table and pass the retrieved tables to FM Get_Component_List to get the fields existing for the particular table,
But I cannot pass the dynamic table value to select query to retrieve the data..Please update me if you have anything on retrieving data from dynamically inputted value
Can I do this
Select * from <dyntable>
Any suggestions will be appreciated
thank you -
Passing the column name on Where condition based on input parameter
Hi,
I am using Oracle10g. Following are my table schema.
Table Name : Codes
Columns( ID, Level0, Level1,Level2)
View Name : SampleView
I have a scenario : A parameter will be passed to my view from C# application. I need to cut the last 4 places of the parameter and need to check 4 conditions as follows :
1. IF last 4 places of parameter contains the value as "AMPD" then pass level0 column on where condition.
Sample code : A123XPAMPD
Expeted Result: Select * from Codes where Level0 ='A123XPAMPD'
2. IF last 4 places of parameter contains the value as "Alpha numeric" then pass level1 column on where condition.
Sample code : A123XPAA00
Expeted Result: Select * from Codes where Level1 ='A123XPAA00'
3. IF last 4 places of parameter contains the value as 0000 then pass level1 column on where condition.
Sample code : A123XP0000
Expeted Result: Select * from Codes where Level1 ='A123XP0000'
4. IF last 4 places of parameter contains the value as (cannot be all 0's) and cannot contain "Alphabets" then pass level2 column on where condition.
Sample code : A123XP1001
Expeted Result: Select * from Codes where Level2 ='A123XP1001'
Could any one please help me on writing this logic inside the view.
Thanks in advance.Do you want to make sure that at least one alphabet and one number is there?
select case
when regexp_like('1111','^[a-zA-Z]+$') -"This says - Only alphabets, not even space
THEN 'Alphabets'
when regexp_like('1111','^[a-zA-Z0-9]*$') --"This says - Only alpha-numeric, not even space
and regexp_like('1111','[a-zA-Z]') --"To make sure atleast one alphabet is there
and regexp_like('1111','[0-9]') --"To make sure atleast one number is there
THEN 'AlphaNumeric'
else 'NULL' --"This is a string. Not actual NULL
end
from dual;
{code} -
Pass BPC SSIS variable to stored procedure
Dear All
We have a ssis package in which there is data flow task. There
is a OLEDB source which uses “Data access mode” as sql command. We used OLEDB data source instead of execute sql task as the outuput is table format generated in Stored proc which is used in following task
This task calls a stored procedure with a input parameter which will be appset name. [EXEC ProcName '@BPCAPPSET']
The stored procedure is executing fine without any issues.But when I pass variable containing appset name to that stored procedure its not taking properly and package ending successful.
The variable is “BPCAPPSET” it contains appset name which
will be taken front end.
However to test if this value is taken by stored procedure
or not, I tried to hardcode and pass appset name to stored procedure. i.e exec
ProcName Appset1.
Appset1 is existing appset. It worked fine. But we want to
put this package in all land scapes, such that whenever it is triggered it will
take the appset as parameter and does the calculation in stored procedure.
Please advice how to pass this variable to stored
procedure.
regards
PrasadHi Roberto
Thanks for your mail.
I have tried, but I am getting error that @BPCAPPSET scalar
variable must be defined.
I believe that @BPCAPPSET is system defined variable which
will be passed from Data manager package. May be this is the reason it is not
recognizing this variable?
If so, should I define a variable in SSIS. How can we
assign value of @BPCAPPSET to the newly defined variable?
Please advise. Attached screenshot. -
Pass a datarow as input parameter in a stored procedure
Hi everyone!
I wonder if anyone know how to pass a datarow (better if tipized like "tablenameRow") as input parameter for a stored procedure.
links or suggestions are welcome! (i'm newbie in .net programming, so if you can post some code i'll be really grateful!)
Thank you!Hi,
YES!! its possible you can pass a datarow to a SP from your Dot net application.
Here below i'm going to give you an example for Desktop Application.
For Passing a datarow as Input Parameters, your SP need to support for all these parameters.
I mean, if a data row has 03 Columns. Then your procedure should be able to take 03 arguments/parameters.
--Adjust code according to your need.
--Its for C# Desktop application.
--Visual Studio Professional, Framework (2.0)
//Setting connections.
OracleConnection con=new OracleConnection("Data Source=orcl9i; user id=scott; password=tiger");
OracleComand cmd=new OracleCommand(con);
cmd.Type=CommandType.StoredProcedure; //you are useing SP
cmd.Text="my_stored_procedure"; //Mention SP name.
--if DataRow has Three columns. You need three parameters.
OracleParameter p1=new OracleParameter ();//By default parameters are input parameters.
OracleParameter p2=new OracleParameter ();
OracleParameter p3=new OracleParameter ();
//We assume that Datarow already has data in it.
p1.ParametersName="sp_var1 ";
p1.OracleDbType=OracleDbType.Varchar;
p1.Value=tablenameRow[1]; //Here DataRow object's Column1 is input.
p2.ParametersName="sp_var2 ";
p2.OracleDbType=OracleDbType.Varchar;
p2.Value=tablenameRow[2]; //Here DataRow object's Column2 is input.
p3.ParametersName="sp_var3 ";
p3.OracleDbType=OracleDbType.Varchar;
p3.Value=tablenameRow[3]; //Here DataRow object's Column3 is input.
cmd.OracleParameter.Add(p1); //Add parameters.
cmd.OracleParameter.Add(p2); //Add parameters.
cmd.OracleParameter.Add(p3); //Add parameters.
cmd.ExecuteNonQuery(); //Execute Procedure here.
Feel free to ask if still found problem.
.... -
Passing a CLOB as input parameter
Can someone help me pass a CLOB to a stored procedure in oracle:
begin
-- Call the procedure
A(p_ccn => :p_ccn,
p_xml => :p_xml,
p_out_err_status => :p_out_err_status,
p_out_err_msg => :p_out_err_msg);
end;
Here p_xml is a CLOB.
If I have to run procedure A from SQL*PLUS how do I execute this? When I enter the xml as a string I get this error
ORA-01405: fetched column value is NULL
Please helpCREATE OR REPLACE PROCEDURE A ( p_clob CLOB ) IS
BEGIN
DBMS_OUTPUT.PUT_LINE(TO_CHAR(DBMS_LOB.GETLENGTH(p_clob)));
END;
Procedure created.
SET SERVEROUT ON
EXEC A ( 'XYZ');
3
PL/SQL procedure successfully completed. -
How to call a oracle procedure with in/out parameter frm unix shell script?
Hi,
I need to call an oracle stored procedure from unix script. The procedure has 1 input parameter and 2 output parameter. Please send me the syntax for the same. Based on the output values of procedure, I have to execute some more commands in unix script.
Thanks and regards
AAn example :
TEST@db102 SQL> select ename, job from emp
2 where empno = 7902;
ENAME JOB
FORD ANALYST
TEST@db102 SQL> create or replace procedure show_emp (
2 v_empno in number,
3 v_ename out varchar2,
4 v_job out varchar2 )
5 is
6 begin
7 select ename, job into v_ename, v_job
8 from emp
9 where empno = v_empno;
10 end;
TEST@db102 SQL> /
Procedure created.
TEST@db102 SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[ora102 work db102]$ IN=7902
[ora102 work db102]$ set `sqlplus -s test/test@db102 << !
var out1 varchar2(30);
var out2 varchar2(30);
set pages 0
set feed off
exec show_emp($IN,:out1,:out2);
print
exit
`[ora102 work db102]$ echo $1 $2
FORD ANALYST
[ora102 work db102]$ -
How to send nested object collection to PL/SQL Procedure as an Input param
How to send nested object collection to PL/SQL Procedure as an Input parameter.
The scenario is there is a parent mapping object containing a collection(java.sql.Array) of child objects.
I need to send the parent object collection to PL/SQL procedure as a input parameter.
public class parent{
String attr1;
String attr2;
Child[] attr3;
public class Child{
String attr1;
SubChild[] attr2;
public class SubChild{
String attr1;
Urgent!!!
Edited by: javiost on Apr 30, 2008 2:09 AMjaviost wrote:
How to send nested object collection to PL/SQL Procedure as an Input parameter.There are a few ways to do this, all of which likely depend on the particular database you're using.
Urgent!!!Not to me... -
How to execute a stored procedure with an out parameter ?
Guys I am struggling with executing a stored procedure from sql plus.I mean my stored procedure has 2 input parameter and 1 out put parameter (status of the execution).
MY_PROCEDURE(p_name in varchar2,p_age in number,p_status out varchar2)
end my_procedure;
When I say
EXECUTE MY_PROCEDURE('manohar','Shetty');
i get insufficient parameters errors.
please help.EXECUTE isn't a valid PL/SQL construct. It's a SQL*Plus command. You don't want to put any SQL*Plus commands in a PL/SQL block.
You can always execute a stored procedure purely through PL/SQL
begin
my_stored_procedure( x, y, z );
end;SQL*Plus happens to give you the execute command so you can avoid the begin and end statements.
Justin -
Dynamically Pass a list as input parameter to a Graphical Clac View
Hi All,
Can anyone please let me know if it is possible to pass a list of comma separated values as an input parameter to a graphical calculation view and how this list can be parsed inside the view?
The requirement is to invoke the graphical view using sql script.
Thanks,
GouthamHi Goutham,
Have a look on these documents:
Using Multiple Values in Input parameter for filtering in Graphical Calculation View
SAP HANA: Handling Dynamic Select Column List and Multiple values in input parameter
Regards,
Krishna Tangudu -
Pl/sql Procedure is Not Creating With the CLOB data Type
Hi,
I am Using Oracle 10g Express Edition Release2.... My Doubt is While creating a table With CLOB Data Type the table is created successfully,but while Creating a Procedure With the CLOB Data type i am getting an Error Message
2667/5 PL/SQL: Statement ignored
2667/24 PLS-00382: expression is of wrong type
then i tried With the Varchar2(30000) the Procedure is Created Successfully note i have not changed any thing in my code except the data type.
I am Just Confused ......Why the Procedure is not Created with CLOB Data type?
Please advice ...
Thank U
SHANhi,
Thanks for reply....Another Example
CREATE TABLE USER_MAS (USER_ID VARCHAR2 (20 Byte),MAIL_ID VARCHAR2 (255 Byte));
set serveroutput on
declare
atable varchar2(64) := 'USER_MAS';
acolumn varchar2(64) := 'MAIL_ID';
avalue varchar2(64) := 'NEWYORK' ;
dyn_sql clob;
begin
dyn_sql := 'update '||atable||' set '||acolumn||' = '''||avalue|| '''' ;
dbms_output.put_line(dyn_sql);
execute immediate dyn_sql;
end;
commit ;
Error at line 2
ORA-06550: line 9, column 23:
PLS-00382: expression is of wrong type
ORA-06550: line 9, column 5:
PL/SQL: Statement ignored
When i Changed the Data type to varchar2(64)
update USER_MAS set MAIL_ID = 'NEWYORK'
PL/SQL procedure successfully completed.
Commit complete.
I like to Know the Reason Why the Procedure is Not Created in Oracle 10g XE DB
Note :the Same Script i used in 11g DB the Procedure is Created Successfully....
Why you need use CLOB or VARCHAR2 in your temp_num variable as you sending parameters as number?
In the Procedure we are create some run time queries while executing the procedure. There are around 10 run time queries created.
The size of each query is more than 4000 characters . We then add all the queries using union all after each query to the clob variable as the normal varchar will not support.
Please Advice
Thank U
SHAN -
Passing the xml data as parameter to procedure
i have table like this
CREATE TABLE employeeDetails
EmpName VARCHAR2(50),
EmpSal INTEGER,
DeptNo INTEGER,
JoinDate DATE
i am getting the i/p data in xml format to extract data i saw the code in net.http://riteshk.blogspot.com/2008/09/sending-xml-string-as-input-parameter.html
CREATE OR REPLACE PROCEDURE Insert_Employee_Data (ip_emp_details IN XMLTYPE)
IS
BEGIN
FOR i IN
(SELECT XMLTYPE.EXTRACT (VALUE (a),
'/Root/EmpName/text()').getstringval
() AS ipempname,
XMLTYPE.EXTRACT (VALUE (a), '/Root/EmpSal/text()').getstringval
() AS ipempsal,
XMLTYPE.EXTRACT (VALUE (a), '/Root/DeptNo/text()').getstringval
() AS ipdeptno,
XMLTYPE.EXTRACT (VALUE (a),
'/Root/JoinDate/text()'
).getstringval () AS ipjoindate
FROM TABLE (XMLSEQUENCE (ip_emp_details.EXTRACT ('/EmployeeData/Root')
) a)
LOOP
INSERT INTO EMPLOYEEDETAILS
(empname, empsal, deptno, joindate
VALUES (i.ipempname, i.ipempsal, i.ipdeptno, i.ipjoindate
END LOOP;
END Insert_Employee_Data;
i want to test the procedure in database itself.
how to call the procedure in database to test that procedure by passing sample data.how to pass paratmeters while cakking that procedure in database itself to test that the procedure is working or not
/Thats the way you would test it:
SQL> create table employeedetails
empname varchar2 (50),
empsal integer,
deptno integer,
joindate date
Table created.
SQL> create or replace procedure insert_employee_data (ip_emp_details in xmltype)
is
begin
for i
in (select xmltype.extract (value (a),
'Root/EmpName/text()').getstringval ()
as ipempname,
xmltype.extract (value (a),
'Root/EmpSal/text()').getnumberval ()
as ipempsal,
xmltype.extract (value (a),
'Root/DeptNo/text()').getnumberval ()
as ipdeptno,
xmltype.extract (value (a),
'Root/JoinDate/text()').getstringval ()
as ipjoindate
from table(xmlsequence (
ip_emp_details.extract ('/EmployeeData/Root')
)) a)
loop
insert into employeedetails (empname,
empsal,
deptno,
joindate)
values (i.ipempname,
i.ipempsal,
i.ipdeptno,
to_date (i.ipjoindate, 'dd-mon-rrrr', 'nls_date_language=english'));
end loop;
end insert_employee_data;
Procedure created.
SQL> begin
insert_employee_data(xmltype('<?xml version=''1.0'' encoding=''utf-8'' ?>
<EmployeeData>
<Root>
<EmpName>Ritesh</EmpName>
<EmpSal>10000</EmpSal>
<DeptNo>1010</DeptNo>
<JoinDate>03-Apr-2006</JoinDate>
</Root>
<Root>
<EmpName>Rajiv</EmpName>
<EmpSal>20000</EmpSal>
<DeptNo>2020</DeptNo>
<JoinDate>05-May-2007</JoinDate>
</Root>
</EmployeeData>'));
end;
PL/SQL procedure successfully completed.
SQL> select * from employeedetails
EMPNAME EMPSAL DEPTNO JOINDATE
Ritesh 10000 1010 03.04.06
Rajiv 20000 2020 05.05.07
2 rows selected.Much better and more efficient is of course to completly avoid the loop and just use:
insert into employeedetails
select xmltype.extract (value (a),
'Root/EmpName/text()').getstringval ()
as ipempname,
xmltype.extract (value (a), 'Root/EmpSal/text()').getnumberval ()
as ipempsal,
xmltype.extract (value (a), 'Root/DeptNo/text()').getnumberval ()
as ipdeptno,
to_date (
xmltype.extract (value (a),
'Root/JoinDate/text()').getstringval (),
'dd-mon-rrrr',
'nls_date_language=english'
as ipjoindate
from table (
xmlsequence (ip_emp_details.extract ('/EmployeeData/Root'))
) a;
.... -
I am trying to debug a function and passing a clob column into it as parameter
decalre
val number;
begin
myrecord.myclob := 'abcdefg..............'; -- huge data, i cannot even say select length(myclob)
val := myfunction(myrecord);
end;
How can I pass in myclob (clob column) data into this function to debug ?If the clob is huge, you can always try to pass the clob by reference instead of by value. See ORACLE-BASE - NOCOPY Hint to Improve Performance of OUT and IN OUT Parameters in PL/SQL Code
Maybe you are looking for
-
I'm having this error on my Manage your team page. I've updated the credit card information. the credit card has enough balance for the payment and still I get this error. Also I have a warning on every PC using the Adobe Cloud products stating that
-
Hi, I can't import some videos in photos. Note, this videos used to work fine in iphoto. The files are not corrupted, they opens with VLC, quicktime 7 but not with quicktime !!!
-
Importing a DC and Creating a new development component
Hi, After importing a DC and Creating a new development component, my netweaver developer studio is complaining that the com.sap.tc.webdynpro.progmodel.api.* cannot be resolved. And the strange thing is that if i create a local project and then creat
-
Travel Management - Overlaping Trips
Hi, This is a Travel Managment issue. I have a requirement to permit overlaping of trips in transaction PR05. For example, there is an approved trip from 01/01/2009 to 05/01/2009 in PR05. If you try to enter an overlapping (concurrent) trip say from
-
Safari suggested password, did not save
I just changed the password for a web service (the setup for a network printer) and safari conveniently suggested a password (some random string of numbers and characters), which I accepted. Unfortunately, safari did not seem to have remembered it an