Table type as a parameter
Hi Experts,
I got a function with following importing parameter:
REFERENCE(IM_RECIPIENTS) TYPE ISU_ADR6_TAB OPTIONAL
I created a table 'zdyu_mail' with the structure wich the same as ISU_ADR6_TAB
And I tried to transfer this parameter as following:
DATA: ta_dyu_mail TYPE STANDARD TABLE OF zdyu_mail,
wa_dyu_mail LIKE LINE OF ta_dyu_mail.
TYPES: ty_dyu_mail TYPE STANDARD TABLE OF zdyu_mail.
DATA: v_recipients TYPE ty_dyu_mail.
IM_RECIPIENTS = v_recipients
Where am I worng?
Your function module parameter is of type ISU_ADR6_TAB and your parameter is of type STANDARD TABLE OF zdyu_mail, these are two different types. That's why it is wrong. Follow Glen's advise and it will work.
Similar Messages
-
Calling Stored Procedure with table type as In parameter from Java
Hi Everyone,
Can anyone help me with the sample code to call a stored procedure having input parameter of Table type (consisting of multiple fields) from Java. This job is currently being done by a BPEL process.
We want to implement the same using Java.
Any sample code will be really helpful.
Thanks & Regards,
VikasTo start using a blob you have to insert it into the database and then get it back. Sounds weird but that is how it is. Here is a very simple program to do this:
#include<occi.h>
#include <iostream>
using namespace oracle::occi;
using namespace std;
int main()
try
Environment *env = Environment::createEnvironment(Environment::OBJECT);
Connection *conn = env->createConnection("hr","hr","");
string stmt1 = "insert into blob_tab values (:1) ";
string stmt2 = "select col1 from blob_tab";
Blob blob(conn);
blob.setEmpty(conn);
Statement *stmtObj = conn->createStatement(stmt1);
stmtObj->setBlob(1,blob);
stmtObj->executeUpdate();
conn->commit();
Blob blob1(conn);
Statement *stmtObj2 = conn->createStatement(stmt2);
ResultSet *rs = stmtObj2->executeQuery();
while(rs->next())
blob1 = rs->getBlob(1);
string stmt3 = "begin my_proc(:1) ;end;";
Statement *stmtObj3 = conn->createStatement(stmt3);
stmtObj3->setBlob(1,blob1);
stmtObj3->executeUpdate();
catch (SQLException e)
cout << e.getMessage();
/* The tables and procedure are primitive but ok for demo
create table blob_tab(col1 blob);
create or replace procedure my_proc(arg in blob)
as
begin
-- just a putline here. you can do other more meaningful operations with the blob here
dbms_output.put_line('hello');
end;
}Hope this helps.
Thanks,
Sumit -
Passing PL/SQL table type as IN Parameter to DB Adapter
Hi,
I have an requirement to pass multiple record values(array of values) to an API from BPEL process.
For this,
1) I have created a package procedure having PL/SQL table type variable as IN Parameter.
2) In the BPEL process, created a DB adpater pointing to the above API.(Created wrapper API impicitly)
When I intiated the BPEL process passing multiple values, the API is taking only the first value, ignoring rest of the values.
Any reason, why only the first value is accepted by the API ?
Thanks,
Rapp.If I understand correctly, JPublisher generates a wrapper API for an underlying API that takes a PL/SQL table as an IN parameter. The wrapper will generate and use a SQL nested table as the type for the IN parameter of the wrapper procedure.
The DB adapter DOES support nested tables, varrays, and objects as IN parameters of an API. The problem you are seeing is most likely due to the way you are modeling your BPEL process, specifically with respect to your Assign activities.
When you Assign TO an IN parameter, make sure that you drill down all the way and choose the parameter name in the InputParameters root element. Similarly, when you Assign FROM the API value, you must drill down and choose the name of the OUT parameter in the OutputParameters root element.
In a Transform activity, you would use the FOR construct on the target side to get the values of the nested table or varray from the source side. -
Table type in import parameter in rfc function module
Hi we don't have the table type in our system which exist in the other system which is the import parameter of the rfc function module.so how can we pass the parameter. shell we create the same table type in our system also.it is a table type for a deep structure.
Hello,
I donot have access to CRM box I cannot view the FM. You can verify with the CRM counterpart what exactly is the TYPE for param DATA.
Else you can define a generic internal table (TYPE TABLE) & try calling the FM.
BR,
Suhas -
Oracle Table Type as IN parameter
Hi All,
I am trying to pass an Object from java (which has a List of objects ) as an input to my Oracle Stored Proc.
My java obj would look like:
Class TestObj -- has attribute -> List <Employee> empList
Here the class Employee has some attributes like name, address etc.
Now in Oracle, I have defined the following types:
create or replace type EMP_OBJECT as object
NAME VARCHAR2(10)
, Address VARCHAR2(20)
create or replace type EMP_OBJECT_TABLE as table of EMP_OBJECT ;
create or replace type EMP_OBJECT_PARENT as object
EMP_OBJECT_TABLE_TB EMP_OBJECT_TABLE
create or replace type EMP_OBJECT_PARENT_TABLE as table of EMP_OBJECT_PARENT ;
Now my input param to the stored proc would be the EMP_OBJECT_PARENT_TABLE , something like:
create or replace procedure proc_test
emptab IN EMP_OBJECT_PARENT_TABLE
as
begin
end;
Am i going the correct way? How do I finally access an individual employee's data from my Input parameter?
Thank you.Re: Passing structure to stored procedure
-
Accessing table type from JAVA
Hi Experts,
We are making a custom copy of the std FM COM_BPUS_ORG_CONTPERS_REGISTER .
It is observed that Tables are obsolete and we should not use them in custom function modules.
I can pass a table type in import parameter and export parameter.
Can we access a table type from java layer.
Also, note that this STANDARD function module has parameter IT_BUSINESSPARTNERROLE_ORG which has table type BU_ROLE_T.
Is it possible to access this?
Note:- This Function module is not getting called in standard web shops.
Please let me now how i can access this table type for hava while calling FM so as to input or retrieve valus from it.
Regards
AntonyThe issue with you is more than accessing a table type.
You said:
This Function module is not getting called in standard web shops.
For function modules that are not called as a part of the standard flow, you have to develop your own simple BOM, BO, BEI, BE classes and methods to call the custom RFC - the whole nine yards. See the extension guide and see the Extension Demos 2 and 3 for reference.
See the sample JCO calls from Java to understand how to access the table types. -
How to execute a procedure if out parameter is table type
Hi,
I need to execute a procedure, output parameter of the procedure is table type.
Oracle version I am using is 9.2.0.8 . I am using SQL*Plus
Procedure declaration
PROCEDURE current_open_cycle (p_ban IN repl_cust2.billing_account.ban%TYPE,
v_bill_seq_rec OUT bill_seq_table) ;
Table type declaration
TYPE bill_seq_table IS
TABLE OF bill_seq_rectype INDEX BY BINARY_INTEGER ;
TYPE bill_seq_rectype IS RECORD (v_cycle_run_year repl_cust2.bill.cycle_run_year%TYPE,
v_cycle_run_month repl_cust2.bill.cycle_run_month%TYPE,
v_cycle_code repl_cust2.bill.cycle_code%TYPE,
v_open_cycle BOOLEAN, -- An open cycle
v_billed_cycle BOOLEAN, --
v_invoice_number VARCHAR2(13),
v_start_date DATE,
v_end_date DATE,
v_root_ban repl_cust2.bill.root_ban%TYPE) ;
I tried executing using this script, but it failed. When I execute this oracle lost connection to data base.
declare
r_bill_seq_rec ss_invoice_utilities.bill_seq_table;
begin
ss_invoice_utilities.current_open_cycle(934018003,r_bill_seq_rec);
end;
Please help me how I should write declare block to execute this procedure and also print output of the procedure.
Regards
RaghuI don't see anything wrong with the anonymous block, assuming ss_invoice_utilities is the correct package name. Perhaps a simplified test case would show up what's not working there.
As for printing the contents of an associative array, you'll have to write some code to loop through it and construct a string per row to output via dbms_output, assuming the text will fit within dbms_output's size restrictions in 9i. dbms_output is a debugging tool though - is that the requirement?
btw "pls_integer" is less to type than "binary_integer" ;)
Edited by: William Robertson on Apr 16, 2009 8:35 AM -
How do i declare a user defined table type sproc parameter as a local variable?
I have a procedure that uses a user defined table type.
I am trying to redeclare the @accountList parameter into a local variable but it's not working and says that i must declare the scalar variable @accountList.this is the line that is having the issue: must declare the scalar variable @accountListSET @local_accountList = @accountListALTER PROCEDURE [dbo].[sp_DynamicNumberVisits] @accountList AS integer_list_tbltype READONLY
,@startDate NVARCHAR(50)
,@endDate NVARCHAR(50)
AS
BEGIN
DECLARE @local_accountList AS integer_list_tbltype
DECLARE @local_startDate AS NVARCHAR(50)
DECLARE @local_endDate AS NVARCHAR(50)
SET @local_accountList = @accountList
SET @local_startDate = @startDate
SET @local_endDate = @endDate
CREATE TYPE [dbo].[integer_list_tbltype] AS TABLE(
[n] [int] NOT NULL,
PRIMARY KEY CLUSTERED
[n] ASC
)WITH (IGNORE_DUP_KEY = OFF)
GOWhy are you asking how to be an awful SQL programmer?? Your whole approach to SQL is wrong.
We have a DATE data type so your insanely long NVARCHAR(50) of Chinese Unicode strings is absurd. Perhaps you can post your careful research on this? Can you post one example of a fifty character date in any language?
The use of the "sp_" prefix has special meaning in T-SQL dialect. Good SQL programmers do not use CREATE TYPE for anything. It is dialect and useless. It is how OO programmers fake it in SQL.
The design flaw of using a "tbl-" prefix on town names is called "tibbling" and we laugh at it.
There are no lists in RDBMS; all values are shown as scalar values. First Normal Form (1NF)? This looks like a set, which would have a name.
In any -- repeat any -- declarative programming language, we do not use local variables. You have done nothing right at any level. You need more help than forum kludges.
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL -
Java call stored procedure with nested table type parameter?
Hi experts!
I need to call stored procedure that contains nested table type parameter, but I don't know how to handle it.
The following is my pl/sql code:
create or replace package test_package as
type row_abc is record(
col1 varchar2(16),
col2 varchar2(16),
col3 varchar2(16 )
type matrix_abc is table of row_abc index by binary_integer;
PROCEDURE test_matrix(p_arg1 IN VARCHAR2,
p_arg2 IN VARCHAR2,
p_arg3 IN VARCHAR2,
p_out OUT matrix_abc
END test_package;
create or replace package body test_package as
PROCEDURE test_matrix(p_arg1 IN VARCHAR2,
p_arg2 IN VARCHAR2,
p_arg3 IN VARCHAR2,
p_out OUT matrix_abc
IS
v_sn NUMBER(8):=0 ;
BEGIN
LOOP
EXIT WHEN v_sn>5 ;
v_sn := v_sn + 1;
p_out(v_sn).col1 := 'col1_'||to_char(v_sn)|| p_arg1 ;
p_out(v_sn).col2 := 'col2_'||to_char(v_sn)||p_arg2 ;
p_out(v_sn).col3 := 'col3_'||to_char(v_sn)||p_arg3 ;
END LOOP ;
END ;
END test_package ;
My java code is following, it doesn't work:
Class.forName ("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection
("jdbc:oracle:thin:@10.16.102.176:1540:dev", "scott", "tiger");
con.setAutoCommit(false);
CallableStatement ps = null;
String sql = " begin test_package.test_matrix( ?, ? , ? , ? ); end ; ";
ps = con.prepareCall(sql);
ps.setString(1,"p1");
ps.setString(2,"p2");
ps.setString(3,"p3");
ps.registerOutParameter(4,OracleTypes.CURSOR);
ps.execute();
ResultSet rset = (ResultSet) ps.getObject(1);
error message :
PLS-00306: wrong number or types of arguments in call to 'TEST_MATRIX'
ORA-06550: line 1, column 8:
PL/SQL: Statement ignored
Regards
LouisLouis,
If I'm not mistaken, record types are not allowed. However, you can use object types instead. However, they must be database types. In other words, something like:
create or replace type ROW_ABC as object (
col1 varchar2(16),
col2 varchar2(16),
col3 varchar2(16 )
create or replace type MATRIX_ABC as table of ROW_ABC
/Then you can use the "ARRAY" and "STRUCT" (SQL) types in your java code. If I remember correctly, I recently answered a similar question either in this forum, or at JavaRanch -- but I'm too lazy to look for it now. Do a search for the terms "ARRAY" and "STRUCT".
For your information, there are also code samples of how to do this on the OTN Web site.
Good Luck,
Avi. -
Procedure with table type out parameter
Hi,
I need to create a procedure which gives back a content of a table as an out parameter.
i have tried something like below code
it might not be correct since i am writing from home and cannot access any oracle db right now
create or replace procedure test (
table_out test_table%rowtype
) as
type table_out test_table%rowtype
begin
select * into table_out
from test_table
where country = 'HUN';
end;
compile doesnt gives error, but when running it i get error
declare
table_out test_table%rowtype
begin
test( table_out );
dbms_output.put_line( table_out );
end;
but it fails, could you help how to solve the above problem and call the proc correctly?
thanks in advanceWell you said you want the content of a table but your example says you just want a record. So for a record:
CREATE OR REPLACE PROCEDURE sp_test (EMP_REC OUT EMP%ROWTYPE) IS
BEGIN
select * into emp_rec from emp where empno = 7369;
END;The anonymous block to run it might be:
declare
tab_out emp%rowtype;
begin
sp_test(tab_out);
dbms_output.put_line(tab_out.ename);
end;As damorgan said the dbms_output can't be used with the record type. Notice I used it for the ENAME value of the record.
If you really want the entire table then do it the way damorgan suggests. A pipeline function can give you the table but not as an OUT parameter. -
Package with table data type as out parameter.
Hi there, I managed to compile the package without error but when I am trying to test this package and
I am keep facing this error message.
Am I using correctly for the table data type as out parameter. I have no idea what is wrong with the package to fix.
Pls. help and advise me. Thanks.
Error starting at line 1 in command:
DECLARE
p_stmodel VARCHAR2(40):=null;
p_item_number VARCHAR(40):='9BX158-300';
p_item_id NUMBER:=0;
l_attribute_out test_common_api.l_item_attr_tab:=test_common_api.l_item_attr_tab();
BEGIN
test_common_api.test_attribute(p_stmodel,p_item_number,p_item_id,l_attribute_out);
END;
Error report:
ORA-06550: line 8, column 18:
PLS-00302: component 'TEST_ATTRIBUTE' must be declared
ORA-06550: line 8, column 2:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
---------Package.
CREATE OR REPLACE PACKAGE test_common_api
AS
TYPE item_attr_rec IS RECORD (CONFIGURATION VARCHAR2(20),
PRODUCTTYPE VARCHAR2(30),
INTERNALPRODUCTNAME VARCHAR2(20),
NUMBEROFHEADS VARCHAR2(2),
NUMBEROFDISCS VARCHAR2(2),
GENERATION VARCHAR2(10),
FACTORYAPPLICATION VARCHAR2(150),
PRODUCTFAMILY VARCHAR2(60),
FORMFACTOR VARCHAR2(10),
FORMATTEDCAPACITY NUMBER,
FORMATTEDCAPACITY_UOM VARCHAR2(20),
INTERFACE VARCHAR2(30),
SPINDLESPEEDRPM NUMBER,
PRODUCTCACHE VARCHAR2(10),
WARRANTYMONTHS VARCHAR2(2),
PHYSICAL_SECTOR_SIZE NUMBER,
MODELHEIGHT VARCHAR2(10),
ENCRYPTION_TYPE VARCHAR2(40));
TYPE l_item_attr_tab IS TABLE OF item_attr_rec;
END test_common_api;
show errors
create or replace package body test_common_api
AS
PROCEDURE test_attribute (p_stmodel IN VARCHAR2,
p_item_number IN VARCHAR2,
p_item_id IN NUMBER,
l_item_attr_list OUT l_item_attr_tab)
IS
l_stmodel st.stmodelnumber%TYPE;
l_market_segment VARCHAR2(10) ;
l_sub_market_segment VARCHAR2(10) ;
l_app_segment VARCHAR2(10);
l_market_name VARCHAR2(40) ;
l_ccitem seaeng_ccitemnumber.ccitemnumber%TYPE;
l_query_item VARCHAR2(1000);
l_query_model VARCHAR2(1000);
l_where VARCHAR2(1000);
l_bind_var1 VARCHAR2(40);
l_bind_var2 VARCHAR2(40);
l_sql NUMBER:=0;
l_config VARCHAR2(40):=null;
BEGIN
IF p_stmodel is not null THEN
l_where :='WHERE sc.ccmodel = sp.productmodelnumber AND sp.stmodelnumber = st.stmodelnumber
AND sc.pricingdescriptor=''MODEL''
AND sc.ccdashnumber =''000''
AND sp.detailedproductname=''GENERIC''
AND st.stmodelnumber= :1';
IF p_item_number is null AND p_item_id is null THEN
l_config :='null';
ELSE
l_config :='sc.configuration';
END IF;
l_bind_var1 :=p_stmodel;
l_sql :=1;
ELSE
IF p_item_id is null and p_item_number is not null THEN
l_where := 'WHERE sc.ccmodel = sp.productmodelnumber AND sp.stmodelnumber = st.stmodelnumber and sc.ccitemnumber = :1';
l_bind_var1 :=p_item_number;
l_sql:=2;
ELSIF p_item_id is NOT null and p_item_number is null THEN
l_where := 'WHERE sc.ccmodel= sp.productmodelnumber AND sp.stmodelnumber = st.stmodelnumber and sc.ccitemnumber in ( select msi.segment1
from mtl_system_items msi
where msi.inventory_item_id = :1)';
l_bind_var1 := p_item_id;
l_sql:=2;
ELSIF p_item_id is not null and p_item_number is not null THEN
l_where :='WHERE sc.ccmodel = sp.productmodelnumber AND sp.stmodelnumber = st.stmodelnumber and sc.ccitemnumber in (select msi.segment1
from mtl_system_items msi
where msi.inventory_item_id = :1
AND msi.segment1=:2)';
l_sql:=3;
l_bind_var1 := p_item_id ;
l_bind_var2 :=p_item_number;
END IF;
END IF;
l_query_item :='SELECT sc.configuration,st.producttype, sp.internalproductname, sp.numberofheads , sp.numberofdiscs,
sp.generation,sp.factoryapplication, st.productfamily,st.formfactor , st.formattedcapacity , st.formattedcapacity_uom,
st.interface,st.spindlespeedrpm,st.productcache,st.warrantymonths, st.physical_sector_size, st.modelheight, st.encryption_type
FROM pm sp , st st, seaeng_ccitemnumber sc ';
l_query_model :='SELECT '|| l_config|| ' , st.producttype, null,null , null, null, sp.factoryapplication, null,st.formfactor, st.formattedcapacity,
st.formattedcapacity_uom,st.interface , st.spindlespeedrpm, st.productcache, st.warrantymonths,st.physical_sector_size, st.modelheight,
st.encryption_type
FROM pm sp , st st, seaeng_ccitemnumber sc ';
IF l_sql = 1 THEN
EXECUTE IMMEDIATE l_query_model ||l_where
BULK COLLECT INTO l_item_attr_list
USING l_bind_var1 ;
dbms_output.put_line(l_query_model||l_where);
ELSIF
l_sql =2 THEN
EXECUTE IMMEDIATE l_query_item || l_where
BULK COLLECT INTO l_item_attr_list
using l_bind_var1;
dbms_output.put_line(l_query_item||l_where);
ELSE
EXECUTE IMMEDIATE l_query_item ||l_where
BULK COLLECT INTO l_item_attr_list
USING l_bind_var1, l_bind_var2 ;
dbms_output.put_line(l_query_item||l_where);
END IF;
END test_attribute;
END test_common_api;
show errorsI think you forget to declare "PROCEDURE test_attribute" procedure in your package definition. like:
CREATE OR REPLACE PACKAGE test_common_api
AS
TYPE item_attr_rec IS RECORD (CONFIGURATION VARCHAR2(20),
PRODUCTTYPE VARCHAR2(30),
INTERNALPRODUCTNAME VARCHAR2(20),
NUMBEROFHEADS VARCHAR2(2),
NUMBEROFDISCS VARCHAR2(2),
GENERATION VARCHAR2(10),
FACTORYAPPLICATION VARCHAR2(150),
PRODUCTFAMILY VARCHAR2(60),
FORMFACTOR VARCHAR2(10),
FORMATTEDCAPACITY NUMBER,
FORMATTEDCAPACITY_UOM VARCHAR2(20),
INTERFACE VARCHAR2(30),
SPINDLESPEEDRPM NUMBER,
PRODUCTCACHE VARCHAR2(10),
WARRANTYMONTHS VARCHAR2(2),
PHYSICAL_SECTOR_SIZE NUMBER,
MODELHEIGHT VARCHAR2(10),
ENCRYPTION_TYPE VARCHAR2(40));
PROCEDURE test_attribute (p_stmodel IN VARCHAR2,
p_item_number IN VARCHAR2,
p_item_id IN NUMBER,
l_item_attr_list OUT l_item_attr_tab);
TYPE l_item_attr_tab IS TABLE OF item_attr_rec;
END test_common_api;
show errors
create or replace package body test_common_api
AS
PROCEDURE test_attribute (p_stmodel IN VARCHAR2,
p_item_number IN VARCHAR2,
p_item_id IN NUMBER,
l_item_attr_list OUT l_item_attr_tab)
IS
l_stmodel st.stmodelnumber%TYPE;
l_market_segment VARCHAR2(10) ;
l_sub_market_segment VARCHAR2(10) ;
l_app_segment VARCHAR2(10);
l_market_name VARCHAR2(40) ;
l_ccitem seaeng_ccitemnumber.ccitemnumber%TYPE;
l_query_item VARCHAR2(1000);
l_query_model VARCHAR2(1000);
l_where VARCHAR2(1000);
l_bind_var1 VARCHAR2(40);
l_bind_var2 VARCHAR2(40);
l_sql NUMBER:=0;
l_config VARCHAR2(40):=null;
BEGIN
IF p_stmodel is not null THEN
l_where :='WHERE sc.ccmodel = sp.productmodelnumber AND sp.stmodelnumber = st.stmodelnumber
AND sc.pricingdescriptor=''MODEL''
AND sc.ccdashnumber =''000''
AND sp.detailedproductname=''GENERIC''
AND st.stmodelnumber= :1';
IF p_item_number is null AND p_item_id is null THEN
l_config :='null';
ELSE
l_config :='sc.configuration';
END IF;
l_bind_var1 :=p_stmodel;
l_sql :=1;
ELSE
IF p_item_id is null and p_item_number is not null THEN
l_where := 'WHERE sc.ccmodel = sp.productmodelnumber AND sp.stmodelnumber = st.stmodelnumber and sc.ccitemnumber = :1';
l_bind_var1 :=p_item_number;
l_sql:=2;
ELSIF p_item_id is NOT null and p_item_number is null THEN
l_where := 'WHERE sc.ccmodel= sp.productmodelnumber AND sp.stmodelnumber = st.stmodelnumber and sc.ccitemnumber in ( select msi.segment1
from mtl_system_items msi
where msi.inventory_item_id = :1)';
l_bind_var1 := p_item_id;
l_sql:=2;
ELSIF p_item_id is not null and p_item_number is not null THEN
l_where :='WHERE sc.ccmodel = sp.productmodelnumber AND sp.stmodelnumber = st.stmodelnumber and sc.ccitemnumber in (select msi.segment1
from mtl_system_items msi
where msi.inventory_item_id = :1
AND msi.segment1=:2)';
l_sql:=3;
l_bind_var1 := p_item_id ;
l_bind_var2 :=p_item_number;
END IF;
END IF;
l_query_item :='SELECT sc.configuration,st.producttype, sp.internalproductname, sp.numberofheads , sp.numberofdiscs,
sp.generation,sp.factoryapplication, st.productfamily,st.formfactor , st.formattedcapacity , st.formattedcapacity_uom,
st.interface,st.spindlespeedrpm,st.productcache,st.warrantymonths, st.physical_sector_size, st.modelheight, st.encryption_type
FROM pm sp , st st, seaeng_ccitemnumber sc ';
l_query_model :='SELECT '|| l_config|| ' , st.producttype, null,null , null, null, sp.factoryapplication, null,st.formfactor, st.formattedcapacity,
st.formattedcapacity_uom,st.interface , st.spindlespeedrpm, st.productcache, st.warrantymonths,st.physical_sector_size, st.modelheight,
st.encryption_type
FROM pm sp , st st, seaeng_ccitemnumber sc ';
IF l_sql = 1 THEN
EXECUTE IMMEDIATE l_query_model ||l_where
BULK COLLECT INTO l_item_attr_list
USING l_bind_var1 ;
dbms_output.put_line(l_query_model||l_where);
ELSIF
l_sql =2 THEN
EXECUTE IMMEDIATE l_query_item || l_where
BULK COLLECT INTO l_item_attr_list
using l_bind_var1;
dbms_output.put_line(l_query_item||l_where);
ELSE
EXECUTE IMMEDIATE l_query_item ||l_where
BULK COLLECT INTO l_item_attr_list
USING l_bind_var1, l_bind_var2 ;
dbms_output.put_line(l_query_item||l_where);
END IF;
END test_attribute;
END test_common_api;
show errors -
How to pass parameter to cursor for loop having table type?
Hi Friends,
I am wondering how to pass a parameter into second for loop in the example code below.Please see the bold statements and answer my queries.
Thanks a lot .Here is the code .
declare
l_bom_header_tbl BOM_BO_PUB.BOM_HEADER_TBL_TYPE ; ---TABLE TYPE
V_bom_header_tbl Bom_Bo_Pub.Bom_Head_Rec_Type := Bom_Bo_Pub.G_MISS_BOM_HEADER_REC; ---Record type
v_bom_components_tbl Bom_Bo_Pub.Bom_Comps_Tbl_Type := Bom_Bo_Pub.G_MISS_BOM_COMPONENT_TBL;---nested table type
c:=0 number ;
k:=1 number ;
begin
BOMPXINQ.Export_BOM(
P_org_hierarchy_name => l_org_hierarchy_name,
P_assembly_item_name => l_assembly_item_name,
P_organization_code => l_organization_code,
P_alternate_bm_designator => '1Test',
P_Costs => l_costs,
P_Cost_type_id => l_cost_type_id,
X_bom_header_tbl => l_bom_header_tbl,
X_bom_revisions_tbl => l_bom_revisions_tbl,
X_bom_components_tbl => l_bom_components_tbl,
X_bom_ref_designators_tbl => l_bom_ref_designators_tbl,
X_bom_sub_components_tbl => l_bom_sub_components_tbl,
X_bom_comp_ops_tbl => l_bom_comp_ops_tbl,
X_Err_Msg => l_Err_Msg,
X_Error_Code => l_Error_Code);
if l_Error_Code = 0 then
for i in 1 .. l_bom_header_tbl.COUNT LOOP
V_bom_header_tbl.organization_code :='DSC';
Can we assign a table type to record type like below statement?
V_bom_header_tbl.assembly_item_name:= l_bom_header_tbl(i).assembly_item_name ;
k:=1;
I want to pass parameter l_bom_header_tbl(i).assembly_item_name into the for statement below: How to achieve this?
for j in 1 .. l_bom_components_tbl.COUNT LOOP
Can we assign a table type to table type like below statement?
v_bom_components_tbl(k).Assembly_Item_name := l_bom_header_tbl(i).assembly_item_name ;
k := k + 1;
end LOOP;
end loop;
end;
Edited by: ILovePlSql on Mar 22, 2010 7:51 AM
Edited by: ILovePlSql on Mar 22, 2010 8:16 AMILovePlSql wrote:
V_bom_header_tbl.assembly_item_name:= l_bom_header_tbl(i).assembly_item_name ;
v_bom_header_tabl is a record type and l_bom_header_tbl is a table type .So is the above statement ok?I asked you for type definition. Please provide definition of BOM_BO_PUB.BOM_HEADER_TBL_TYPE and Bom_Bo_Pub.Bom_Head_Rec_Type. If BOM_BO_PUB.BOM_HEADER_TBL_TYPE is table of Bom_Bo_Pub.Bom_Head_Rec_Type then your statment is OK. For example:
SQL> declare
2 type BOM_HEADER_TBL_TYPE is table of emp%rowtype index by binary_integer;
3 l_bom_header_tbl BOM_HEADER_TBL_TYPE;
4 V_bom_header_tbl emp%rowtype;
5 begin
6 select * bulk collect into l_bom_header_tbl from emp;
7 for i in 1 .. l_bom_header_tbl.count loop
8 V_bom_header_tbl.ename := l_bom_header_tbl(i).ename;
9 end loop;
10 end;
11 /
PL/SQL procedure successfully completed.
SQL> SY. -
Is it possible to pass table type values as input parameter for con prg?
Hi All,
Could you please confirm that is it possible to pass table type value as input to concurrent program?
If possible how to achive this?
If not possible whether we have any ora doc which is confirming this.
Any hel will be great.
Thanks,Hi student;
Please check (http://apps2fusion.com/at/45-as/241-enablingdisabling-concurrent-program-parameters)
Hope it helps
Regard
Helios -
Passing parameters to PL/SQL table types
Hi Everybody,
I have one question about passing PL/SQL tables types and tabs as IN parameter in procedure.I am working in 11.2.0.2.0 environment. I am stuck on how to pass those values to procedure.Please find below more details:
Table 1:
CREATE TABLE ITEMS
ITEM_ID VARCHAR2(40 BYTE) NOT NULL,
ITEM_NAME VARCHAR2(40 BYTE),
SERIAL NUMBER(2),
ADDED_ON DATE);
Table 2:
CREATE TABLE ITEM_ACTIVITY_INFO
ITEM_ID VARCHAR2(40 BYTE) NOT NULL,
ACCOUNT_TYPE VARCHAR2(1 BYTE),
ID_NUMBER NUMBER(3),
ACTIVATION_DATE DATE);
Table 3:
CREATE TABLE ITEM_GROUP
GROUP_ID NUMBER(2) NOT NULL,
ITEM_ID VARCHAR2(40 BYTE),
GROUP_TYPE VARCHAR2(20 BYTE),
GROUP_DATE DATE);
Table 4:
CREATE TABLE ITEM_ADDRESS
GROUP_ID NUMBER(2) NOT NULL,
NAME VARCHAR2(60 BYTE),
ADDRESS VARCHAR2(100));
Following types are created:
CREATE OR REPLACE TYPE ITEMS_TYPE AS OBJECT
ITEM_ID VARCHAR2(40 BYTE),
ITEM_NAME VARCHAR2(40 BYTE),
SERIAL NUMBER(2),
ADDED_ON DATE);
CREATE OR REPLACE TYPE ITEM_ACTIVITY_TYPE AS OBJECT
ITEM_ID VARCHAR2(40 BYTE),
ACCOUNT_TYPE VARCHAR2(1 BYTE),
ID_NUMBER NUMBER(3),
ACTIVATION_DATE DATE);
CREATE OR REPLACE TYPE ITEM_GROUP_COMP_TYPE AS OBJECT
GROUP_ID NUMBER(2) NOT NULL,
ITEM_ID VARCHAR2(40 BYTE),
GROUP_TYPE VARCHAR2(20 BYTE),
GROUP_DATE DATE
ITEM_ADDRESS_IN ITEM_ADDRESS_TYPE);
CREATE OR REPLACE TYPE ITEM_ADDRESS_TYPE AS OBJECT
GROUP_ID NUMBER(2),
NAME VARCHAR2(60 BYTE),
ADDRESS VARCHAR2(100));
CREATE OR REPLACE TYPE ITEM_GROUP_COMP_TAB AS TABLE OF ITEM_GROUP_COMP_TYPE;
Create or replace procedure ITEM_ADD_CHANGE(
ITEM_IN IN ITEMS_TYPE,
ITEM_ACTIVITY_IN IN ITEM_ACTIVITY_TYPE,
ITEM_GROUP_IN IN ITEM_GROUP_COMP_TAB,
ITEM_OUT IN OUT ITEMS.ITEM_ID%TYPE);
Above are the paramteres we are passing to procedure.
I need help in how to pass parameters to above procedure. All comments and responses will be highly appreciated. Thanks everyone for going through the post. Please let me know if more more information is required on this problem.
Regards
DevBilly Verreynne wrote:
Types used in this fashion, only make sense if the table is based on the type. It makes very little sense to have a table structure and then to duplicate the structure using a type.
The 2 structures may be defined the same. But they are NOT interchangeable and requires one to be converted to the other to use. This is not sensible in my view. It is far easier in that case to simply use the PL/SQL macro +%RowType+ to create a duplicate structure definition - one that can natively be used for touching that table, without conversions required.
If you do want to use types, define the type, then define the table of that type, adding the required constraints (pk, fk, not null, check) to the table's definition.Billy:
Just curious, why do you say it makes very little sense to have a type modeled on a table? I do that a lot. In my case, I am getting the values from an external program, not building them manually, but it makes a lot of sense to me.
One application where I do this a lot has a java front-end that parses HL7 messages. Each message contains at least minimal information about a variable number of entities (and often several rows for an entity) in the database, and must be processed as a single atomic trasnaction. So, rather than have potentially hundreds of parameters to the "main" driver procedures for different message types I created a set of types more or less identical to the tables representing the entities. The java program parses the mesasge and populates the type, then calls the appropriate stored procedure for the message type passing in the populated types. My stored procedure then does inserts/updates or deletes as appropriate over potentially dozens of tables.
John -
Assigning data from one Table type to another structure
Hi every one,
I have a table type X sent from one function module to another Proxy generated method which has the parameter defined as a structure.
I have declared a variable Y as a LINE TYPE OF X.
Then I have this statement which fills up the data.
READ TABLE X INTO Y INDEX 1.
The data is transferred from X to Y.
Now i need to send this to the proxy generated Function module which has a structure Z.
Now when i say MOVE-CORRESPONDING Y to a variable of type Z, it says it cannot be converted.
The structure in proxy generated FM has different data type but the same domain as that of standard one.
Everywhere it is prefixed with YY.
And also has one additional Controller tab inserted,
Can you guys tell me how to move the data from this table type to the structure.
- VenkatHi,
Declare a variable of line type Z.
Move corresponding values from variable X to this variable.
Append this variable to the table Z.
Try this.
Regards,
R.Nagarajan.
Maybe you are looking for
-
Can I use a mini-DVI to HDMI adapter to use my HDTV as a monitor?
I've been looking into this and haven't found a direct and complete answer yet. I read this article that states its possible when using mini-DVI to VGA/DVI adapters, but didn't mention mini-DVI to HDMI adapters. http://support.apple.com/kb/HT3413 App
-
Ic Webclient - Default first selection on the Navbar
Hi All I have a requirment that when a user logs onto the web ic, they see the identify account view i.e. the Identify Account link on the navigation bar is selected and the identify account view is visible. Thanks
-
Acrobat Upgrade and Signature Appearances
We're about to upgrade our Acrobat users from X to XI. We've got a number of users who have created custom signature appearances they use when signing documents. In the past when we upgraded Acrobat these signature appearances were lost. Is there a w
-
Kerberos n00b help with CentOS integration
Hi all, I've inherited an OD installation and I have a few questions. First, the LDAP search base is dc=spidertracks, dc=local and the Kerberos Realm is SERVER.PRIVATE. This was upgraded to Advanced server mode from Simple mode. I would like to accom
-
Hi all, I've just finished a project in Captivate 7 and I've got it on my LMS. But I can't open on an iPad. I've selected both flash and HTML5 and (reluctantly) got rid of my slide transitions and other non-html objects, but it just gets stuck at 'Lo