calling a procedure with nested table as input param type
Hello
I have a guy like that table.
create or replace type table_type like table of the varchar2 (4000);
I have a procedure like this.
proc_temp (v_table_type, table_type)
Start
key code...
end;
I have a table like this.
tab_test_data
--------------------
ABCD
efghd
MNOP
XYXX
I want to move this data in table tab_test_data as param of entry while calling this proc could you please tell me how the procedure that calls the statement will be the writtern.
I try like this.
----------------------------
declare
TABLE_TYPE v_table;
Start
proce_temp (v_table); - here, I want to pass data to the table as entry
end;
/
You already have the data in a table (tab_test_data), then why don't you just use the table inside the proce_temp? Why should I set a collection type and pass it as a parameter? Collections use the expensive PGA memory. If the application that you build this way may have some serious scalability issues.
Sort of a technical solution would be like this. You can use BULK COLLECT.
declare
TABLE_TYPE v_table;
Start
Select to bulk column_name fired in v_table
of tab_test_data;proce_temp (v_table);
end;
/
Tags: Database
Similar Questions
-
Hello. I have a problem of creating tables with nested tables.
After you have created a few types, I would create a table based on these, but I get
SQL error: ORA-00904: invalid identifier
+ 00904. 00000 - '% s: invalid identifier ' +.
over and over again. This is my SQL code:
1 create or replace TYPE t_indirizzo () AS OBJECT
via VARCHAR (45), 2
3 NUMBER,
4 cap INTEGER (5).
5 Città varchar (30),
6 provincia varchar (30),
region 7 varchar (30)
)
8 create or replace TYPE t_telefono () AS OBJECT
9 num_tel Number (15)
)
10 create or replace TYPE t_listaTelefono AS TABLE OF THE t_telefono
11 create or replace TYPE t_cliente () AS OBJECT
12 cod_cliente NUMBER (8).
13 address t_indirizzo,
14 email varchar (30),
Telefono 15 t_listaTelefono
(16) NOT FINAL
17 CREATE TABLE client (t_cliente)
18 cod_cliente NOT NULL,
19 address NOT NULL,
email 20 NOT NULL,
21 PRIMARY KEY (cod_cliente)
(22) TABLE IMBRIQUE 'telefono' STORE AS 'numTelCli_tab '.
23 RETURN VALUE
My version of Oracle is 10.2.0. Thank you in advance.
Published by: user11231503 on 2.35 giu-8-2009so, just to be sure, run this:
create or replace TYPE t_indirizzo AS OBJECT ( via VARCHAR(45), numero NUMBER, cap INTEGER(5), citta VARCHAR(30), provincia VARCHAR(30), regione VARCHAR(30) ); / create or replace TYPE t_telefono AS OBJECT ( num_tel NUMBER(15) ); / create or replace TYPE t_listaTelefono AS TABLE OF t_telefono / create or replace TYPE t_cliente AS OBJECT ( cod_cliente NUMBER(8), indirizzo t_indirizzo, email VARCHAR(30), telefono t_listaTelefono ) NOT FINAL; / CREATE TABLE cliente OF t_cliente( cod_cliente NOT NULL, indirizzo NOT NULL, email NOT NULL, PRIMARY KEY (cod_cliente) ) nested table telefono store as numTelCli_tab return as value /
-
With nested table test procedure
Hello by the Expert,
I have a procedure that accepts an array as an input parameter. Now my problem is how to test this procedure from sqlplus. strugling with passing values using table...
Details:
Oracle: Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production.
Procedure: sp_dl_ins_stg_tab_npi (i_provider_npi_arr IN provider_npi_nt)
-> provider_npi_nt is a nested table.
Structure of the table:
create or replace type provider_identifier_typ as an object
(
provider_identifier VARCHAR2 (30),
identifier_type VARCHAR2 (15)
)
create or replace type provider_identifier_nt in the provider_identifier_typ table;
create or replace type provider_npi_type as object)
aut_official_nm_suffix VARCHAR2 (10),
aut_official_credential_txt VARCHAR2 (100),
provider_identifier_tab provider_identifier_nt
)
create or replace type provider_npi_nt in the provider_npi_typ table;
Note: provider_npi_type Type is nested with provider_identifier_nt
Appreciate your help
ConcerningHello
You will need to use an anonymous block to build the table and call the procedure.
For example:DECLARE npi_nt provider_npi_nt; BEGIN npi_nt := provider_npi_nt( provider_npi_typ('A', 'some text', provider_identifier_nt( provider_identifier_typ('ID-A1','Type1'), provider_identifier_typ('ID-A2','Type2') ) ), provider_npi_typ('B', 'some text', provider_identifier_nt( provider_identifier_typ('ID-B1','Type1'), provider_identifier_typ('ID-B2','Type2'), provider_identifier_typ('ID-B2','Type3') ) ) ); SP_DL_INS_STG_TAB_NPI(npi_nt); END; /
Here, I created the object of each manufacturer of nesting. As you can see, it can quickly become a process of 'painful '.
On the contrary, if your data is in the database tables, the table can be built more easily with a single query. -
Hi all!
I learn PL/SQL on the book by Steve Bobrovsky (specified below, sample comes from it) and I have a question.
In the procedure of the below specified program used a currentElement integer variable to get the reference to the line in the nested table of data type % ROWTYPE.
Meanwhile, the program itself uses a common FOR... LOOP counter I have.
When I substituted a global variable of INTEGER type such for... The LOOP counter, an APEX have returned an error "ORA-01403: no data found.DECLARE TYPE partsTable IS TABLE OF parts%ROWTYPE; tempParts partsTable := partsTable(); CURSOR selectedParts IS SELECT * FROM parts ORDER BY id; currentPart selectedParts%ROWTYPE; currentElement INTEGER; PROCEDURE printParts(p_title IN VARCHAR2, p_collection IN partsTable) IS BEGIN DBMS_OUTPUT.PUT_LINE(' '); DBMS_OUTPUT.PUT_LINE(p_title || ' elements: ' || p_collection.COUNT); currentElement := p_collection.FIRST; FOR i IN 1 .. p_collection.COUNT LOOP DBMS_OUTPUT.PUT('Element #' || currentElement || ' is '); IF tempParts(currentElement).id IS NULL THEN DBMS_OUTPUT.PUT_LINE('an empty element.'); ELSE DBMS_OUTPUT.PUT_LINE('ID: ' || tempParts(currentElement).id || ' DESCRIPTION: ' || tempParts(currentElement).description); END IF; currentElement := p_collection.NEXT(currentElement); END LOOP; END printParts; BEGIN FOR currentPart IN selectedParts LOOP tempParts.EXTEND(2); tempParts(tempParts.LAST) := currentPart; END LOOP; printParts('Densely populated', tempParts); FOR i IN 1 .. tempParts.COUNT LOOP IF tempParts(i).id is NULL THEN tempParts.DELETE(i); END IF; END LOOP; FOR i IN 1 .. 50 LOOP DBMS_OUTPUT.PUT('-'); END LOOP; printParts('Sparsely populated', tempParts); END; /
When I tried to manage this code in SQL * Plus, the following picture emerged:DECLARE TYPE partsTable IS TABLE OF parts%ROWTYPE; tempParts partsTable := partsTable(); CURSOR selectedParts IS SELECT * FROM parts ORDER BY id; currentPart selectedParts%ROWTYPE; PROCEDURE printParts(p_title IN VARCHAR2, p_collection IN partsTable) IS BEGIN DBMS_OUTPUT.PUT_LINE(' '); DBMS_OUTPUT.PUT_LINE(p_title || ' elements: ' || p_collection.COUNT); FOR i IN 1 .. p_collection.COUNT LOOP DBMS_OUTPUT.PUT('Element is '); IF tempParts(i).id IS NULL THEN DBMS_OUTPUT.PUT_LINE('an empty element.'); ELSE DBMS_OUTPUT.PUT_LINE('ID: ' || tempParts(i).id || ' DESCRIPTION: ' || tempParts(i).description); END IF; END LOOP; END printParts; BEGIN FOR currentPart IN selectedParts LOOP tempParts.EXTEND(2); tempParts(tempParts.LAST) := currentPart; END LOOP; printParts('Densely populated', tempParts); FOR i IN 1 .. tempParts.COUNT LOOP IF tempParts(i).id is NULL THEN tempParts.DELETE(i); END IF; END LOOP; FOR i IN 1 .. 50 LOOP DBMS_OUTPUT.PUT('-'); END LOOP; printParts('Sparsely populated', tempParts); END; /
What's not in the code (or what I did not understand)? Help please!Densely populated elements: 10 Element is an empty element. Element is ID: 1 DESCRIPTION: Fax Machine Element is an empty element. Element is ID: 2 DESCRIPTION: Copy Machine Element is an empty element. Element is ID: 3 DESCRIPTION: Laptop PC Element is an empty element. Element is ID: 4 DESCRIPTION: Desktop PC Element is an empty element. Element is ID: 5 DESCRIPTION: Scanner -------------------------------------------------- Sparsely populated elements: 5 DECLARE * ERROR at line 1: ORA-01403: no data found ORA-06512: at line 14 ORA-06512: at line 35
Your error occurs because you are dealing with a sparsely populated collection and using an index for items that do not exist.
For collections of the low density of population, you must iterate through using FIRST and THEN as modeled not from 1 to COUNT.
The crucial difference between your code and the example is:
tempParts(i)
Which, as you have demonstrated, doesn't work very well (!) if there is no item (i).
The code example is a little unusual in my opinion.
currentElement := p_collection.FIRST; FOR i IN 1 .. p_collection.COUNT LOOP ... currentElement := p_collection.NEXT(currentElement); END LOOP;
It works, but it's an unusual way to iterate through a collection of rare which is perhaps most often done like this:
currentElement := p_collection.FIRST; WHILE(currentElement IS NOT NULL) LOOP ... currentElement := p_collection.NEXT(currentElement); END LOOP;
Which is perhaps less open to confusion.
In the end, the distinction between
tempParts(currentElement).id
and
tempParts(i).id
is crucial.
-
Calling stored procedure with an input of DATE parameter
Hello. A question about the Date input parameters when you call a stored procedure.
I have a procedure that takes a DATE as input parameter. I would DATE this value to include a time element.
My Application Module method takes an input as a java.util.Date (myParamDate) parameter - that will preserve a time element (?).
However when I create the CallableStatement, I am trying to set the parameter using setDate like this (for the param 5):
I understand java.sql.Date does NOT include a time element. But setDate() only accepts a java.sql.Date so my parameter of the procedure ends with a zero time element.st = getDBTransaction().createCallableStatement("begin cs_my_pck.request_values(?,?,?,?,?,?,?,?); end;", 0); Connection myConn = st.getConnection(); ArrayDescriptor myArrDesc = ArrayDescriptor.createDescriptor("CS_FIELD_TABT", myConn); Array sqlParamNameArray = new oracle.sql.ARRAY(myArrDesc, myConn, paramNames.toArray()); Array sqlParamValueArray = new oracle.sql.ARRAY(myArrDesc, myConn, paramValues.toArray()); Array sqlFilterNameArray = new oracle.sql.ARRAY(myArrDesc,myConn,filterNames.toArray()); st.setString(1, repType); st.setObject(2, sqlParamNameArray); st.setObject(3,sqlParamValueArray); st.setObject(4,sqlFilterNameArray); java.sql.Date myRepDate = new java.sql.Date(myParamDate.getTime()); st.setDate(5,myRepDate); System.out.println("Report Date = " + myRepDate.toString()); st.setString(6,repUser); st.setString(7,repAttach); // set out param st.registerOutParameter(8, Types.NUMERIC); st.execute();
How to call this procedure keeping the time element?
Thank you.It includes the time element, if you want more precision with time stamp.
http://docs.Oracle.com/javase/6/docs/API/Java/SQL/date.html
-
Calling stored procedures with parameters with the database connectivity Toolkit
Hi all
I'm new to the forum and struggling to find a solution to a particular problem I have in this respect, using the LabVIEW Database Connectivity Toolkit on a project, I am currently working on my work. I have a database in which I tables and stored procedures with parameters. Some of these stored procedures have input, output and return parameters.
I tried to follow this example, but to no avail: http://digital.ni.com/public.nsf/allkb/07FD130746083E0686257300006326C4?OpenDocument
Such a stored procedure I am working on the implementation is named "dbo.getAllowablePNs", running "SELECT * from DeviceType" (DeviceType is the table). In this case, it requires no input parameter, it has an output parameter that generates the table [cluster] and has a return parameter that returns an integer value (status code for execution) to show if an error occurred. The DeviceType table has 3 columns; ID (PK, int not null), PN (nvarchar ((15), null) and NumMACAddresses (int, null).) I have surpassed many examples and I talk to the support OR try to implement this and similar procedures stored in LabVIEW but have not been successful. I am able to connect to the database with the VI of open connection without error, but spin in some confusion as a result of this step. I then try to use the VI of parameter query create to call the stored procedure and set the parameters. I guess I would then use the Set parameter value for each parameter that is connected to the entry of parameters on the previous query with parameters VI VI? I am also having some confusion during and after these steps as well. I would greatly appreciate advice or suggestions that anyone could have in this situation because I am not a SQL expert. Also, I would be happy to provide more information that might be useful.
Kind regards
Jon
Here's what I use to do this. I think I had to change him create parameterized query VI for him to work. There is a post on the forum about this somewhere.
-
Call Oracle procedure with variable
Experts,
I pass arguments through script to Oracle procedure, use the input value and pass to the procedure.
Oracle procedure Gets the input value, run the query, and all connect to the log file.
I am facing a few challenges, seems to be the error of syntax or data type
1. even if I pass all the script parameter still run complains of wrong number or type of arguments.
There are three numbers followed by a date variable
2. how to pass a variable value with the INTERVAL function, it should take the value of the variable lThird for example "" AND date > = date + INTERVAL '30' MINUTE; "but somehow, after trying different variants still get error like interavl not valid."
3 see someone more changes to this?
$1 = 10;
$2 = 30;
3 = $50
$4 = '20150113';
echo "Oracle procedure in progress"
(
set linesize 100
pkg.proc exec ($1, $2, $3, $4);
) > $logFile
If [$? == 0]
then
EXIT_VAL = 0
= Package/oracle procedure =.
CREATE or REPLACE PACKAGE pkg
AS
procedure proc (lFirst in number,
lSecond in numbers
lThird in numbers
date IN oven,
curReturn to sys_refcursor);
Pkg of END;
/
CREATE or REPLACE PACKAGE pkg BODY
AS
PROCEDURE proc (lFirst in number,
lSecond in numbers
lThird in numbers
date IN oven,
curReturn ON sys_refcursor)
IS
BEGIN
OPEN FOR CurReturn
SELECT date,
emp_id,
first name,
last_name
Employees
WHERE Emp_id in (lFirst, lSecond)
Date AND > = date + MINUTE INTERVAL "(lThird)"
AND date = TO_DATE (oven, 'YYYYMMDD')-1;
END proc;
Pkg of END;
/
Error:
PLS-306: wrong number or types of argument in the call to proc
Hello
With regard to your needs:
My current problem is
1. how to store the SELECT results in the log file, ask has several columns with multiple lines
2. what happens when SELECT brings out no line?
I have re-used, corrected and adapted to your procedure:
Package:
CREATE or REPLACE PACKAGE pkg
AS
PROCEDURE proc (lFirst in number,
lSecond in numbers
lThird IN varchar2,
curReturn to sys_refcursor);
Pkg of END;
/
CREATE or REPLACE PACKAGE pkg BODY
AS
PROCEDURE proc (lFirst in number,
lSecond in numbers
lThird IN varchar2,
curReturn ON sys_refcursor)
IS
BEGIN
OPEN FOR CurReturn
SELECT *.
WCP
WHERE empno in (lFirst, lSecond)
AND hiredate > = TO_DATE (lThird, 'YYYYMMDD');
END proc;
Pkg of END;
/
Shell script: test_sql.sh
#! / bin/ksh
V_user = scott
V_pass = Tiger
echo "Oracle procedure in progress"
Req ='sqlplus-s $V_user / $V_pass<>
var refcursor rc
exec pkg.proc ($1, $2, $3,: rc)
print the rc
output
EXPRESSIONS OF FOLKLORE"
echo "$req" > logfile$ $
PS:
(1) you must put the name of your user/passwd name and table (I used the scott/tiger schema by default with emp table). This is just to show how to retrieve a refcursor output in a script.
(2) I used logfile$ $ as output file; You can use any other file or method name to redirect the output to a file
Call us at:
19000101 7934 7900 test_sql.sh
PS: As noted in the previous posts, you cannot define a VARIABLE of type DATE in sqlplus (or a Unix script); You can send a string and perform the conversion in the SQL section.
If no line is not recovered, you get the following in the log file:
PL/SQL procedure successfully completed. no rows selected
HTH.
-
How to call a procedure with parameter SYS_REFCURSOR OUT
Hello
With the help of Oracle 11 g R2.
I would like to know if it is possible to display the results of a SYS_REFCURSOR in a query. For example, if I had the following stored procedure
create or replace procedure testprocedure (result OUT sys_refcursor) as begin open result for select 1 from dual union all select 2 from dual; end;
I want to call this procedure similar to how a query is called and executed. Like this
Select * from testprocedure
I have seen lots of examples on the web that show how it is possible to loop through the results of a sys_refcursor inside an anonymous block and display the results using dbms_output.putline, but this isn't the method I'm looking for.
Read this: PL/SQL 101: understanding Ref Cursor
You're wrong if you think a ref cursor is a result set of data that you can query from.
-
How to call a procedure with two arguments.
Hello
I have a procedure with two arguments, IE. MyProcedure (p1 in numbers, p2 in number) to display an image blob.
How can I call this image blob in the url.
I tried http://127.0.0.1:7777/pls/apex/SCHEMA.myprocedure?p1=1 & p2 = 2, but it does not work...
Thank you
VincentVincent,
As long as you've got the possibility to execute the procedure and there is no space in the url and you have not misspelled the names of parameters then it looks right.
Here is a link to a procedure to download a file that takes two parameters.
http://mywebsite.com/pls/htmldev/schema.package.function.download_file?p_session_id=1221970786026206&p_seq_id=724
See you soon,.
Janet Tyson
-
Error in the importation of tables with nested table types
Hello
I have two tables with the nested table type when I m try to import a schema to another all tables with error to give the type of identifying different
Here is my order of import
imp leader = tables_nested.dmp ignore = y fromuser = ABC touser = DEV_SCHEMA toid_novalidate = sup_payment_type
I tried to import with the option TOID_NOVALIDATE, but it says
IMP-00086: TOLD 'SUP_PAYMENT_TYPE' not found in the export file
Here, the view of my log file.
. . table import 'CONTRACT' 788 imported lines
. . importation of "EQUIPMENT" 4301 imported table lines
. . rows in table 'CONT_EQUIPMENT' import imported 4300
IMP-00017: statement failed with error ORACLE 2304:
"CREATE TYPE"SUP_PAYMENT_TYPE"TIMESTAMP" 2007-11 - 28:10:50:50' OID "3FF6F10."
"CADC08A99E040A8C0010178F9"AS OBJECT ().
"CONT_NO NUMBER".
"EQP_NO NUMBER".
"PMT_NO NUMBER".
'DATE OF PLAN_PMT_DATE '.
"S_NO NUMBER".
"BATCH_NO NUMBER".
'DATE OF TRAN_DT '.
'DATE OF ACTUAL_PMT_DATE '.
"ACTUAL_PAID_AMT_CURR NUMBER".
"ACTUAL_PAID_AMT_KZT NUMBER".
"PMT_CURSTYP_CD NUMBER".
'NUMBER OF PMT_EXG_RATE);'
IMP-00003: ORACLE error 2304
ORA-02304: invalid literal object identifier
IMP-00063: WARNING: jump table "DEV_SCHEMA". "" SUPPLIER_PAYMENT "as the type of the object
'DEV_SCHEMA '. "' SUP_PAYMENT_TYPE ' could not be created or has identify different
About to activate the constraints...
Thank youBaptist
Get the error on tahiti, I realized this must be a common problem and is described in Metaclunk.
So in Metaclunk I get "ora-02304 imp' and came up with 1066139.6 ML.
It describes your situation.
So many times, it is very easy to solve your problems in a few minutes. I always wonder why people walk immediately into shock and horror and nothing to do when they hit a mistake.----
Sybrand Bakker
Senior Oracle DBA -
Calling a procedure with IN and OUT parameters
Hello
I usually call my procedures using the following
declare the variable msg_erreur varchar2 (50)
exec simple_msg('ABC,'ABC','ABC',:error_msg);
CREATE OR REPLACE PROCEDURE SIMPLE_MSG)
ID IN VARCHAR2,
URL IN VARCHAR2,
THE LIST IN VARCHAR2,
MSG_ERREUR OUT VARCHAR2
*************************************************************
Now my question is, I try to call a proc that has IN OUT parameters. Can someone guide me on how to call the d.a. thanks
CREATE OR REPLACE PROCEDURE SIMPLE_MSG)
ID IN VARCHAR2,
URL IN VARCHAR2,
THE LIST IN VARCHAR2,
NAME IN VARCHAR OUT,
MSG_ERREUR OUT VARCHAR2Hello
OUTSIDE of the parameters are passed as OUT was: you must pass a variable.
If you set the IN OUT parameter before calling the procedure, and then either
(a) use the separate EXEC command:EXEC :name := 'Original name'; EXEC simple_msg ('ABC', 'ABC', 'ABC', :name, :error_msg);
or
(b) use a PL/SQL anonymous block, like this:
BEGIN :name := 'Original name'; simple_msg ('ABC', 'ABC', 'ABC', :name, :error_msg); END; /
The parameter can be either a variable binding (as illustrated above), or a local variable (which may only be used in the block).
-
Problem using the list separated by commas with nested table element
Hello
I have a list separated by commas like this:
And want to create a function that creates a where clause clause for each element with an output like this:H23004,H24005,T7231,T8231,T9231
Here's my test function that is not working properly:UPPER('H23004') IN (UPPER(charge)) OR UPPER('H23005') IN (UPPER(charge)) OR UPPER('T7231') IN (UPPER(charge)) OR UPPER('T8231') IN (UPPER(charge)) OR UPPER('T9231') IN (UPPER(charge))
The out put looks like this:create or replace function FNC_LIST_TO_WHERE_CLAUSE(v_list in VARCHAR2) return varchar2 is -- declaration of list type TYPE batch_type IS TABLE OF pr_stamm.charge%TYPE; -- variable for Batches v_batch batch_type := batch_type('''' || replace(v_list,',',''',''') || ''''); return_script varchar2(1000); BEGIN -- loop as long as there are objects left FOR i IN v_batch.FIRST .. v_batch.LAST LOOP --DBMS_OUTPUT.PUT_LINE(offices(i)); -- create where clause IF i = 1 THEN return_script := 'UPPER(' || v_batch(i) || ') IN (UPPER(charge))'; ELSE return_script := return_script || ' OR UPPER(' || v_batch(i) || ') IN (UPPER(charge))'; END IF; END LOOP; return (return_script); end;
I don't know what I did wrong? It calculates the amount of the incorrect array element! (v_batch. Must be 5)UPPER('H23004','H24005','T7231','T8231','T9231') IN (UPPER(charge))
v_batch. FIRST = 1
v_batch. LAST = 1
Kind regards
TobiasTry this...
declare
text varchar2 (1000): = "H23004, H24005, T7231, T8231, T9231;
v_where varchar2 (1000);
Start
Text: = text | «, » ;
While instr (text, ',') <> 0
loop
v_where: = v_where | ' UPPER ("': substr (Text, 1, InStr(Text,',',1)-1) |") ' IN (UPPER (load)) OR ';
text: = substr (text, instr(text,',',1) + 1);
end loop;
v_where: = substr (v_where, 1, length (v_where)-3);
dbms_output.put_line (v_where);
end;convert it to function...
-
The procedure with parameter output from test object type
I have the sub object created with spec and body type.
I need to test the procedure seen ino parameter object type.
could you please help me test the procedure!
create or replace type typ_obj_test as object ( a_date date, a_type varchar2(10), a_status varchar2(2), descr varchar2(10), a_id number(10), constructor function typ_obj_test(a_date date ,a_type varchar2 default null ,a_status varchar2 default null ,descr varchar2 default null ,a_id number default null) return self as result ); / create or replace type body typ_obj_test is constructor function typ_obj_test(a_date date ,a_type varchar2 default null ,a_status varchar2 default null ,descr varchar2 default null ,a_id number default null) return self as result is v_test varchar2(1); v_id number(10); begin self.a_date := a_date; self.a_type := a_type; self.a_status := a_status; self.descr := descr; self.a_id := a_id; return; end; end; / create or replace procedure p_obj_test(p_obj_param in out typ_obj_test) is begin dbms_output.put_line('Checking the object type' || p_obj_param.a_date || '@' || p_obj_param.a_type || '@' || p_obj_param.a_status || '@' || p_obj_param.descr || '@' || p_obj_param.a_id); end; /
You seem to be missing a table that could hold the object. See the next topic, especially the line # 43:
Connected to: Oracle Database 11g Release 11.2.0.3.0 - 64bit Production SQL> create or replace type typ_obj_test as object 2 ( 3 a_date date, 4 a_type varchar2(10), 5 a_status varchar2(2), 6 descr varchar2(10), 7 a_id number(10), 8 constructor function typ_obj_test(a_date date 9 ,a_type varchar2 default null 10 ,a_status varchar2 default null 11 ,descr varchar2 default null 12 ,a_id number default null) return self as result 13 ); 14 / Type created. SQL> create or replace type body typ_obj_test is 2 constructor function typ_obj_test(a_date date 3 ,a_type varchar2 default null 4 ,a_status varchar2 default null 5 ,descr varchar2 default null 6 ,a_id number default null) return self as result is 7 v_test varchar2(1); 8 v_id number(10); 9 begin 10 self.a_date := a_date; 11 self.a_type := a_type; 12 self.a_status := a_status; 13 self.descr := descr; 14 self.a_id := a_id; 15 return; 16 end; 17 end; 18 / Type body created. -- Create a Nested table type array of above object type SQL> create or replace type nt_typ_obj_test as table of typ_obj_test; 2 / Type created. -- Keep in out parameter's type as the nested table type -- modified the proc to do loop so that multiple records can be passed via object type SQL> create or replace procedure p_obj_test(p_obj_param in out nt_typ_obj_test) is 2 begin 3 for i in p_obj_param.first..p_obj_param.last 4 loop 5 dbms_output.put_line('Checking the object type' || p_obj_param(i).a_date || '@' || p_obj_param(i).a_type || '@' || p_obj_param(i).a_status || '@' || 6 p_obj_param(i).descr || '@' || p_obj_param(i).a_id); 7 end loop; 8 end; 9 / Procedure created. --Call the procedure SQL> set serveroutput on SQL> declare 2 i_nt_typ nt_typ_obj_test ; 3 begin 4 i_nt_typ:=nt_typ_obj_test(typ_obj_test(sysdate,'A','Y','Descr',23),typ_obj_test(sysdate,'X','Z','ewe',55)); 5 p_obj_test(i_nt_typ); 6 end; 7 / Checking the object type26-MAR-15@A@Y@Descr@23 Checking the object type26-MAR-15@X@Z@ewe@55 PL/SQL procedure successfully completed. SQL>
-
Create the stored procedure with the table from another throw diagram PLS-00201
Oracle 10g. I'm new on procedures, so maybe I'm missing something obvious.
The ABC schema owner has table T2001_WRITEOFF. The SYSDBAs given SIUD Some_Update_Role and granted this role to developer user IJK. IJK user then created a private synonym T2001_WRITEOFF for ABC. T2001_WRITEOFF. It worked with the usual SQL DML commands.
When I try to create a simple procedure, it throws PLS-00201 identifier "T2001_WRITEOFF" must be declared and the points of the 2nd line.
create or replace procedure woof1(
fooname in T2001_WRITEOFF.territory%TYPE, <=== error points here
bardesc IN T2001_WRITEOFF.ind_batch_submit%TYPE) IS
BEGIN
INSERT into T2001_WRITEOFF
VALUES ( fooname, bardesc);
END woof1;
/What I am doing wrong?
Thank you
JimR
Grant the necessary rights directly to the user (not through a role):
http://asktom.Oracle.com/pls/asktom/asktom.download_file?p_file=6551289900368934430
-
What is the syntax to call a procedure with named parameters?
I should know this, but I can't seem to remember how to do it and did not find reference.
If I have a procedure like this:
CREATE or REPLACE myProc (inParam1 IN VARCHAR2, inParam2 in NUMBERS)...
If I want to call this stored proc with a call control and the name of the parameters instead of having to go through position, how should I do that?
That is to say, I know that I can do: call the myProc('somevalue'1)
But I want to be able to do something like this: call myproc (inParam1: = "somevalue", inParam2: = 1)-which doesn't seem to work. Anyone know the syntax I'm looking for?
Thank you!I don't know if you are referring to the call to the procedure according to the parameters.
His
Call MyProc (inParam1-online "somevalue", inParam2-online 1)
call MyProc (inParam2-online 1, inParam1-online "somevalue")
Hopefully it's that you make reference to.
Maybe you are looking for
-
migration wizard to set up the new mac
Did a time machine at the top on an old mac and want to transfer only files in my documents folder, but not the Apps on a new machine. Two use of machines, OS ElCapitan which of the three options I have need to select Migration Wizard to minimize tra
-
Satellite L450D - cannot use the product recovery disc
Hello I'm new to this forum and have spent 3 days reading this and other forums to try to solve my problem, I found a lot of answers, but none does not work for me so I'd see if I could get the thought some very great need help here. Now, I have the
-
Satellite A200 - does not start, no display
Hello When I turn the power on the Panel before right lights are on and I can hear the fan and something about loading, but then I get two beeps sounds and nothing ever shows up. No BIOS, no start menu, no Toshiba splash, nothing. I read in the media
-
HP r-062tu: key pad is loose
I recently bought a laptop but unfortunately after a month or two keys on my keyboard started loose even if they are not much loose but I feel uncomfortable by the keys, I thought to call the customer service but my keys are very loose and I don't th
-
Digital inputs only noisy when the laptop is plugged
I had problems with loops of Earth and power supplies for laptop in the past. But it is the first time I got it so wrong that it makes the digital inputs which are both related to the ground and the debounced software cannot be used. It is NOT mater