HI All
I need help regarding this, i have a procedure that processes some data. I created one more procedure and i am calling the first procedure from the second with some parameters. Out of the available parameters, there are two which should be of table type.
How to pass a table type parameters and how to declare them
please help me out
vamsi
13 41710
The easiest way should be using a package that contains a TYPE of table, and use the aliases of this table as input parameter types. Check this: -
-
CREATE OR REPLACE PACKAGE test_table AS
-
TYPE emp_data IS TABLE OF emp%ROWTYPE;
-
END test_table;
-
/
-
-
CREATE OR REPLACE PROCEDURE first_proc(a IN NUMBER, emp_dat IN OUT test_table.emp_data NOCOPY) AS
-
BEGIN
-
SELECT * BULK COLLECT INTO emp_dat FROM emp;
-
END first_proc;
-
/
-
-
DECLARE
-
empd test_table.emp_data;
-
num1 INTEGER;
-
BEGIN
-
first_proc(num1, empd);
-
FOR I IN empd.FIRST..empd.LAST LOOP
-
DBMS_OUTPUT.PUT_LINE(empd(i).empno);
-
END LOOP;
-
END;
-
/
-
-
Note: I have not tested this code!!
Thank u ver much, i 'll try that but just check this code which i have written. -
-
CREATE OR REPLACE PROCEDURE XXBIOUK_STATUS_UPDT_PROC
-
AS
-
===================table type=====================
-
type v_attributes_category is table of varchar2(1000)
-
index by binary_integer;
-
type v_n_attributes_tbl is table of number
-
index by binary_integer;
-
type v_d_attributes_tbl is table of date
-
index by binary_integer;
-
-
=========== table type ===
-
v_a v_attributes_category;
-
v_b v_attributes_category;
-
v_c v_n_attributes_tbl;
-
v_d v_d_attributes_tbl;
-
=====================cursor==================
-
CURSOR c_lotnumber_cur
-
IS
-
SELECT
-
organization_id,
-
inventory_item_id,
-
lot_number,
-
item_number,
-
attribute1,
-
expiration_date,
-
lot_status
-
FROM
-
xxbio_lotnumber_status
-
WHERE
-
org_group_name = 'USA'
-
OR org_group_name = 'UK'
-
AND lot_status = 'APPROVED'
-
OR lot_status = 'REJECT'
-
AND erp_extract_flag='N';
-
========================================
-
BEGIN
-
FOR ln_rec_counter IN c_lotnumber_cur
-
LOOP
-
=====calling a package.proc inside loop========
-
inv_lot_api_pub.update_inv_lot
-
(
-
=======passing table type params to proc====
-
v_a,
-
v_b,
-
v_c,
-
v_d,
-
0;
-
==============error i get =======
-
-
-
PLS-00306: wrong number or types of arguments in call to
-
'UPDATE_INV_LOT'
-
what might be the problem
Can you post the proceudre within your package for reference?
inv_lot_api_pub .update_inv_lot ?
-
-
PROCEDURE update_inv_lot(
-
x_return_status OUT NOCOPY VARCHAR2
-
, x_msg_count OUT NOCOPY NUMBER
-
, x_msg_data OUT NOCOPY VARCHAR2
-
, p_inventory_item_id IN NUMBER
-
, p_organization_id IN NUMBER
-
, p_lot_number IN VARCHAR2
-
, p_expiration_date IN DATE
-
, p_disable_flag IN NUMBER
-
, p_attribute_category IN VARCHAR2
-
, p_lot_attribute_category IN VARCHAR2
-
, p_attributes_tbl IN inv_lot_api_pub.char_tbl
-
, p_c_attributes_tbl IN inv_lot_api_pub.char_tbl
-
, p_n_attributes_tbl IN inv_lot_api_pub.number_tbl
-
, p_d_attributes_tbl IN inv_lot_api_pub.date_tbl
-
, p_grade_code IN VARCHAR2
-
, p_origination_date IN DATE
-
, p_date_code IN VARCHAR2
-
, p_status_id IN NUMBER
-
, p_change_date IN DATE
-
, p_age IN NUMBER
-
, p_retest_date IN DATE
-
, p_maturity_date IN DATE
-
, p_item_size IN NUMBER
-
, p_color IN VARCHAR2
-
, p_volume IN NUMBER
-
, p_volume_uom IN VARCHAR2
-
, p_place_of_origin IN VARCHAR2
-
, p_best_by_date IN DATE
-
, p_length IN NUMBER
-
, p_length_uom IN VARCHAR2
-
, p_recycled_content IN NUMBER
-
, p_thickness IN NUMBER
-
, p_thickness_uom IN VARCHAR2
-
, p_width IN NUMBER
-
, p_width_uom IN VARCHAR2
-
, p_territory_code IN VARCHAR2
-
, p_supplier_lot_number IN VARCHAR2
-
, p_vendor_name IN VARCHAR2
-
, p_source IN NUMBER
-
) IS
-
I see when you are calling this procedure, ou are passing only 4-6 vales but this procedure has lots of input parameters, that is the reason the error is coming. You need to make the parameters optional in case of avoiding an error or pass all the parameter values when calling that procedure
-
-
inv_lot_api_pub.update_inv_lot
-
(
-
v_inventory_item_id,
-
v_organization_id,
-
v_lot_number,
-
null,--p_expiration_date
-
null,--p_disable_flag
-
null,--p_attribute_category
-
null,--p_lot_attribute_category
-
v_a ,--p_attributes_tbl
-
v_b,--p_c_attributes_tbl
-
v_c,--p_n_attributes_tbl
-
v_d,--p_d_attributes_tbl
-
null,--p_grade_code
-
null,--p_origination_date
-
null,--p_date_code
-
null,--p_status_id
-
null,--p_change_date
-
null,--p_age
-
null,--p_retest_date
-
null,--p_maturity_date
-
null,--p_item_size
-
null,--p_color
-
null,--p_volume
-
null,--p_volume_uom
-
null,--p_place_of_origin
-
null,--p_best_by_date
-
null,--p_length
-
null,--p_length_uom
-
null,--p_recycled_content
-
null,--p_thickness
-
null,--p_thickness_uom
-
null,--p_width
-
null,--p_width_uom
-
null,--p_territory_code
-
null,--p_supplier_lot_number
-
null,--p_vendor_name
-
null--p_source
-
);
-
-
now i am passing all the parameters, still the error persists. is this the correct way to send table type parameter and moreover i didnt take any value into v_a,v_b......, its just declared as table type object.
You need to pass a variables for the following OUT parameters as well: -
-
x_return_status OUT NOCOPY VARCHAR2
-
, x_msg_count OUT NOCOPY NUMBER
-
, x_msg_data OUT NOCOPY VARCHAR2
-
-
i created a table type variable as -
-
create or replace package my_pack as
-
-
type v_attributes_category is table of varchar2(1000)
-
index by binary_integer;
-
-
v_a v_attributes_category;
-
-
cusor c_cur is
-
select name_varchar_variable from xx_table where condition;
-
-
for i in c_cur
-
loop
-
begin
-
-
v_a = i.name_varchar;
-
-
-
package.procedure(
-
.....
-
....
-
v_a,
-
.....
-
)
-
-
in the above example, i have few doubts
1. is that the right way to assign values to v_a inside a loop of cursor
2. is that the right way to pass v_a, which is table type, to procedure
3. can we use v_a(i) := i. name_varchar to assign value
please help me out,
i used the above sample structure and i get
PLS-00382: expression is of wrong type and
PLS-00306: wrong number or types of arguments in call to procedure
thanks in advance
i created a table type variable as -
-
create or replace package my_pack as
-
-
type v_attributes_category is table of varchar2(1000)
-
index by binary_integer;
-
-
v_a v_attributes_category;
-
-
cusor c_cur is
-
select name_varchar_variable from xx_table where condition;
-
-
for i in c_cur
-
loop
-
begin
-
-
v_a = i.name_varchar;
-
-
-
package.procedure(
-
.....
-
....
-
v_a,
-
.....
-
)
-
-
in the above example, i have few doubts
1. is that the right way to assign values to v_a inside a loop of cursor
2. is that the right way to pass v_a, which is table type, to procedure
3. can we use v_a(i) := i. name_varchar to assign value
please help me out,
i used the above sample structure and i get
PLS-00382: expression is of wrong type and
PLS-00306: wrong number or types of arguments in call to procedure
thanks in advance
2 and 3 are correct. First is incorrect. You cannot assign a value to an array that way. Instead use your point 3 for assiging a value to an array of table.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: wkaras |
last post by:
I would like to propose the following changes to the C++ Standard,
the goal of which are to provide an improved ability to specify
the constraints on type parameters to templates. Let me say from
the start that my knowledge of compiler implementation is very
limited. Therefore, my suggestions may have to be rejected
because they are difficult or impossible to implement.
The proposal is based on the concept of "type similarity". Type...
|
by: john |
last post by:
Hi to All
I would like to do something similar:
class Class1<T1>
{
}
class Class2<T2, T1where T2: Class1<T1>, new()
{
|
by: interX |
last post by:
Hi
I'm new in VC++ and have a question to generics. I have a generic
class, which contains an array of the generic type. This array I can
pin and then I would like to get an unmanaged pointer to it. Therefore
I wanted to creat a class member which represents the pointer to the
array. Unfortunately I get the folowring compile error for the code
beneath:
error C3229: 'DataType *' : indirections on a generic type parameter
|
by: hisham123 |
last post by:
hi,
I Wrote one stored procedure in which i declare one variable as Table
then i stored in that table type variable
select
*
from
emp
so now my table contain one sql statement by 4 rows
now i want to execute the sql statement how (MS SQL SERVER 2000)
|
by: Andrus |
last post by:
I tried to use type parameter to call static method but got compile error
'T' is a 'type parameter', which is not valid in the given context.
Why this is not allowed ?
Should I really use a lot longer ModelGenericBase<T>.test1() ?
Andrus.
| |
by: debasisdas |
last post by:
This thread contains some of the sample code showing the method of executing Oracle stored procedures and functions from VB .
Hope the user finds them useful.
Oracle Procedure with only IN type as parameter mode.
========================================
CREATE OR REPLACE PROCEDURE DEPTINS
(
DNO DEPT.DEPTNO%TYPE,
DN DEPT.DNAME%TYPE,
|
by: DottingTheNet |
last post by:
help plz!!
when i try to cretae a table in a procedure like
create procedure blah
is
begin
create table.....
......
end;
|
by: tadmill |
last post by:
Is it possible to pass a generic parameter of the same class to to its
constructor, where the "T" type passed in the constructor is different
than the "T" type of the instanced class?
ie,
public class SomeList<T>
{
public SomeList(SomeList<TthisSomeList)
|
by: qwedster |
last post by:
Folk!
How to programattically check if null value exists in database table (using stored procedure)?
I know it's possble in the Query Analyzer (see last SQL query batch statements)?
But how can I pass null value as parameter to the database stored procedure programattically using C#?
Although I can check for empty column (the following code passes string.Empty as parameter but how to pass null value?), I cannot check for null value...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |