Executing dynamic procedure with record type
Hi,
I have a small issue...I'm not attaching any tables / data..etc...I just want to know how to pass the record type to a procedure (which are actually obtained from a table) dynaically..Unable to form the sql statement..
I get an error saying that "wrong number or types of arguments in call to ||"...
-- see ** below where I'm getting an error.
.Need to pass the whole record type "l_shl_order_msg"
CREATE OR REPLACE PROCEDURE CM_BUILD_MSG_PRC (P_IN_BLD_MSG_CURSOR IN SYS_REFCURSOR,
P_OUT_BLD_MSG_CURSOR OUT SYS_REFCURSOR)
IS
l_shl_order_msg CRAE_INTERFACE.GLB_VAR_PKG.deid_SHELL_order_typ;
V_MSG_SHELL_NAME VARCHAR2(1000);
V_MESG_TEXT_SEGMENT VARCHAR2(1000);
V_TEXT VARCHAR2(1000);
V_MSG_TEXT VARCHAR2(4000);
V_MSG_FINAL_TEXT VARCHAR2(4000);
V_MSG_PROC VARCHAR2(1000);
V_SQL VARCHAR2(4000);
V_CNT NUMBER;
L_STATUS VARCHAR2(100);
L_REASON VARCHAR2(1000);
BEGIN
LOOP
FETCH P_IN_BLD_MSG_CURSOR
INTO l_shl_order_msg;
EXIT WHEN P_IN_BLD_MSG_CURSOR%NOTFOUND;
END LOOP;
Select mesg_shell_text, mesg_dynamic_var_count
into V_MSG_TEXT, V_CNT
from CRAE_MESG_MASTER
where mesg_shell_name = l_shl_order_msg.SHELL_ID;
For i in 1..V_CNT
LOOP
SELECT MESG_SHELL_NAME, MESG_TEXT_SEGMENT, PROCEDURE_NAME
INTO V_MSG_SHELL_NAME, V_MESG_TEXT_SEGMENT, V_MSG_PROC
FROM CRAE_MESG_MASTER_DETAIL
WHERE I = MESG_SEQ_NUMBER
AND mesg_shell_name = l_shl_order_msg.SHELL_ID;
V_SQL:= 'BEGIN '||V_MSG_PROC||'(''' || l_shl_order_msg|| ''',' ||
'''' || V_MSG_SHELL_NAME || ''',' || '''' || V_MESG_TEXT_SEGMENT
|| ''', CRAE_INTERFACE.GLB_VAR_PKG.V_TEXT );'||'END;';
DBMS_OUTPUT.PUT_LINE(V_SQL);
EXECUTE IMMEDIATE (V_SQL);
V_TEXT := CRAE_INTERFACE.GLB_VAR_PKG.V_TEXT;
IF I = 1
THEN
V_MSG_TEXT := REPLACE(V_MSG_TEXT,V_MESG_TEXT_SEGMENT,V_TEXT);
V_MSG_FINAL_TEXT := V_MSG_TEXT;
ELSE
V_MSG_FINAL_TEXT := REPLACE(V_MSG_FINAL_TEXT,V_MESG_TEXT_SEGMENT,V_TEXT);
END IF;
END LOOP;
DBMS_OUTPUT.PUT_LINE(V_MSG_FINAL_TEXT);
-- L_STATUS := CRAE_INTERFACE.GLB_VAR_PKG.V_STATUS;
-- L_REASON := CRAE_INTERFACE.GLB_VAR_PKG.V_REASON;
OPEN P_OUT_BLD_MSG_CURSOR
FOR
SELECT l_shl_order_msg.MESSAGE_DATE_TIME,
l_shl_order_msg.MASKED_ID,
l_shl_order_msg.OFFSET_DATE,
l_shl_order_msg.PATIENT_ACCOUNT_NUMBER,
l_shl_order_msg.ORDER_CONTROL,
l_shl_order_msg.PLACER_ORDER_NUMBER,
l_shl_order_msg.QUANTITY,
l_shl_order_msg.INTERVAL,
l_shl_order_msg.DURATION,
l_shl_order_msg.START_DATE_TIME,
l_shl_order_msg.END_DATE_TIME,
l_shl_order_msg.PRIORITY,
l_shl_order_msg.ORDERING_DATE,
l_shl_order_msg.ENTERED_BY_ID,
l_shl_order_msg.ENTERED_BY_FAMILY_NAME,
l_shl_order_msg.ENTERED_BY_GIVEN_NAME,
l_shl_order_msg.ORDERED_BY_ID,
l_shl_order_msg.ORDERED_BY_FAMILY_NAME,
l_shl_order_msg.ORDERED_BY_GIVEN_NAME,
l_shl_order_msg.REPEAT_PATTERN,
l_shl_order_msg.DRUG_CODE,
l_shl_order_msg.DRUG_DESCRIPTION,
l_shl_order_msg.REQUESTED_GIVE_AMOUNT,
l_shl_order_msg.REQUESTED_GIVEN_UNIT,
l_shl_order_msg.SIG,
l_shl_order_msg.ALLOW_SUBSTITUTION,
l_shl_order_msg.REQUESTED_DISPENSE_AMOUNT,
l_shl_order_msg.REQUESTED_DISPENSE_UNIT,
l_shl_order_msg.REFILLS,
l_shl_order_msg.ROUTE,
l_shl_order_msg.STATUS,
l_shl_order_msg.REASON,
V_MSG_FINAL_TEXT,
T.COMP_ID,
T.PROC_ID,
T.Procedure_Desc
FROM CRAE_MESG_rule_MASTER T
WHERE MSG_SHELL_NAME = l_shl_order_msg.SHELL_ID;
-- dbms_output.put_line (l_shl_order_msg.MESSAGE_DATE_TIME);
END;** I get an error saying that "wrong number or types of arguments in call to ||"...
Not sure how to pass record type dynamically...
sb,
declare
l_shl_order_msg CRAE_INTERFACE.GLB_VAR_PKG.deid_SHELL_order_typ;
V_MSG_SHELL_NAME VARCHAR2(1000);
V_MESG_TEXT_SEGMENT VARCHAR2(1000);
V_SQL VARCHAR2(4000);
V_MSG_PROC VARCHAR2(1000);
begin
V_SQL := 'BEGIN '||V_MSG_PROC||'(l_shl_order_msg)'||'END;';
DBMS_OUTPUT.PUT_LINE(V_SQL);
end;when I execute this...l_shl_order_msg is passed as variable..but instead I want to pass all columns in the recordtype to be passed..
ex : l_shl_order_msg.id, l_shl_order_msg.name....etc..
This is what is being passed :
BEGIN ATTRIBUTE_PRC( l_shl_order_msg ,'CDS_1','text-1', CRAE_INTERFACE.GLB_VAR_PKG..V_TEXT );
ATTRIBUTE_PRC has already been defines as record type with i/p parameter..
Edited by: user7431648 on Jul 26, 2012 8:25 AM
Edited by: user7431648 on Jul 26, 2012 8:27 AM
Similar Messages
-
Can somebody help...
I have a procedure which takes parameter as IN OUT extended object type .Below is the example.
PROCEDURE p_save (example IN OUT xyz_obj)
my object type "xyz_obj" have elements with other object types also, and that itself have around 100 elements.
And when calling the above procedure for test purpose, how is it possible to pass partial elements of the object type rather than setting all unused elements to null.user13026549 wrote:
Can somebody help...
I have a procedure which takes parameter as IN OUT extended object type .Below is the example.
PROCEDURE p_save (example IN OUT xyz_obj)
my object type "xyz_obj" have elements with other object types also, and that itself have around 100 elements.
And when calling the above procedure for test purpose, how is it possible to pass partial elements of the object type rather than setting all unused elements to null.
It ISN'T possible. How could it be? Each attribute has to be set to something don't you think?
A common way to handle that is to define a public package variable that is an instance of the object type and has ALL elements set to null. As Odie suggested a custom constructor function can be used for that.
Then you create your procedure instance by starting with an instance of the package variable (where everything is null) and setting values for the attributes you need. -
Execute a procedure with a list of array in sql server 2008
HI all,
I have a procedure which has a list of values passed as an array . How can i execute my procedure with array list? how to implement this?Please help me.
Thanks in advance
DeepaHi Deepa,
basically Microsoft SQL Server does not support arrays as data types for procedures. What you can do is creating a type which represents a table definition. This type can than be used in a procedure as the following demo will show:
The first script creates the environment which will be used for the execution
-- 1. create the table as a type in the database
CREATE TYPE OrderItems AS TABLE
ItemId int PRIMARY KEY CLUSTERED
GO
-- 2. demo table for demonstration of results
CREATE TABLE dbo.CustomerOrders
Id int NOT NULL IDENTITY (1, 1) PRIMARY KEY CLUSTERED,
CustomerId int NOT NULL,
ItemId int
GO
-- 3. Insert a few records in demo table
INSERT INTO dbo.CustomerOrders
(CustomerId, ItemId)
VALUES
(1, 1),
(2, 1),
(3, 3),
(1, 3);
GO
-- 4. Create the procedure which accepts the table variable
CREATE PROC dbo.OrderedItemsList
@Orders AS OrderItems READONLY
AS
SET NOCOUNT ON;
SELECT o.*
FROM dbo.CustomerOrders AS O INNER JOIN @Orders AS T_O
ON (o.ItemId = T_O.ItemId);
SET NOCOUNT OFF;
GO
The above script creates the table data type and a demo table with a few demo data. The procedure will accept the table data type as parameter. Keep in mind that table variable parameters have to be READONLY as parameter for procedures!
The second script demonstrates the usage of the above scenario
When the environment has been created the usage is a very simple one as you can see from the next script...
-- 1. Fill the variable table with item ids
DECLARE @o AS OrderItems;
INSERT INTO @o (ItemId)
VALUES
(1), (3);
-- 2. Get the list of customers who bought these items
EXEC dbo.OrderedItemsList @Orders = @o;
MCM - SQL Server 2008
MCSE - SQL Server 2012
db Berater GmbH
SQL Server Blog (german only) -
How to write a shell script to execute a procedure with out parameter
Hi,
How to write a shell script to execute a procedure with out parameter.
here is my procedure
PROCEDURE sample(invar1 VARCHAR2,
invar2 VARCHAR2,
invar3 VARCHAR2,
invar4 VARCHAR2,
ecode out number);
Any example really helpfull
Thanks in advanceOr if we're passing values in, maybe something like:
Test procedure:
CREATE OR REPLACE PROCEDURE p (myin IN VARCHAR2, myout OUT VARCHAR2)
AS
BEGIN
myout :=
CASE myin
WHEN 'A' THEN 'APPLE'
WHEN 'B' THEN 'BANANA'
ELSE 'STARFRUIT'
END;
END;Shell script:
#!/bin/bash
my_shell_variable=$1
unset ORACLE_PATH
sqlplus -s un/pw@db <<-EOF
set feedback off pause off
set pagesize 0
set autoprint off
VAR out varchar2(30)
VAR myin varchar2(30)
exec :myin := '${my_shell_variable}'
BEGIN
p(:myin, :out);
END;
print out
exit
EOFTest:
/Users/williamr: xx A
APPLE
/Users/williamr: xx B
BANANA
/Users/williamr: xx
STARFRUITObviously in a real script you would not hardcode the password or let it show in a "ps" listing.
Message was edited by:
William Robertson -
JDBC-Adapter-Receiver Calling Stored Procedure with Input-Typ Record
Hallo,
I´ m trying calling a stored-procedure with two input-parameter; one of typ record (oracle) and one of type tabel of records. Is this possible (I think there are only types like string, integer etc. possible)? When not is there another possibility to work with that type?
Thanks in advance,
FrankHi Frank,
I think stored procedures will not take Array of Records as a Input. If you want to make a loop funtionality etc then JDBC adapter will work accordingly. You need to just call the stored procedure from the JDBC adapter. It will work for the array of records(multiple occurences).
Receiver JDBC Procedures.
/people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
Alternative option is you can make use of Java Proxy and from there you can call stored procedure ..I think it is possible.. not tried.
Hope this helps
Regards,
Moorthy -
How can I execute a Procedure with OUT variable is %ROWTYPE on SQL Prompt
Hi,
I have a procedure with OUT variable is %ROWTYPE
How can I execute the following procedure on SQL prompt.
(without creating anonymous block)
CREATE OR REPLACE PROCEDURE zz_sp_EMP(VEMPNO IN EMP.EMPNO%TYPE,
V_REC IN OUT EMP%ROWTYPE)
AS
BEGIN
SELECT * INTO V_REC FROM EMP WHERE EMPNO = VEMPNO;
END;
Thanks & Regards,
Nareshas previous posters said: it's not possible to do this without declaring a variable in the anonymous block.
With anonymous block it would look like this (had to change it a bit, since i'm using hr-schema on oracle XE):
declare
l_rec EMPLOYEES%ROWTYPE;
begin
zz_sp_EMP(VEMPNO => 100, V_REC => l_rec);
DBMS_OUTPUT.PUT_LINE ( 'first_name = ' || l_rec.first_name );
DBMS_OUTPUT.PUT_LINE ( 'last_name = ' || l_rec.last_name );
end;
first_name = Steven
last_name = King -
Calling Oracle Stored proc with record type and table Type
I have a oracle SP which takes record type and table Type which are used for order management.
Is there anay way to populate parameters with these datatypes and call the stored procedure using ODP.NET?
Please help.
Thanks in advanceHi,
ODP supports associative arrays and REF Cursors. There is no support for PLSQL table of records.
Jenny -
DB Adapter - Calling Stored Procedure with Object Type
So, we are using JDeveloper 10.1.3.3
We are trying to create an ESB process that invokes a SP with an object type. However, the owner of the package / SP, is NOT the owner of the object type. When going through the DB Adapter wizard, it gives us the following error:
When attempting to use the DB Adapter in JDeveloper to create a partner link to execute a stored procedure. JDeveloper returns the following error:
Unable to import WSDL.
Error while writing wsdl file
Database type is either not supported or is not implemented.
Check to ensure that the type of the parameter is one of the supported datatypes or that there is a collection or user defined type definition representing this type defined in the database.
However, if I create a wrapper package / SP, it works just fine. I'd really like to not be having to create wrapper code for these SPs to work. Is this resolved in 11g? Is there a patch available for 10.1.3.3?
I think this is a JDeveloper Wizard issue, but thought I'd post this here as well.
Thanks,
BradWThis problem can be resolved by granting execute permission on the object type to the caller. For example, if the stored procedure is in schema1 and the object type is in schema2 then you would connect as schema2 and execute
SQL> grant execute on <object type> to schema1
Referencing object types defined in other schemas is documented. This is the described method for accessing object types in other schemas. -
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. -
Hi! I need to work with a Record Type in one of my functions.
I have two questions:
1) In my error handler, how do I return an empty record type
and
2) In the calling procedure, how do I evaluate whether or not my record type contains values.
Any help is greatly appreciated.
Thanks!
~ChristineHi! I need to work with a Record Type in one of my
functions.
I have two questions:
1) In my error handler, how do I return an empty
record type
and
2) In the calling procedure, how do I evaluate
whether or not my record type contains values.
Any help is greatly appreciated.
Thanks!
~ChristineHi,
You can't test if a record is "atomically" NULL. You have two choices:
1- if one of the fields has a not null constraint then you can test using this field.
2- Otherwise, you can use an indicator out parameter that tells you if there is a value or nothing in the record.
Michel -
How to call procedure with Object types in java
Hi,
We have procedure declaration as follows
===============
TYPE TEST_TYPE AS OBJECT (NAME VARCHAR2(10));
TYPE TESTTYPE1 AS object (student1 TESTTYPE,student2 TESTTYPE,student3 TESTTYPE);
TYPE rect AS OBJECT
-- The type has 3 attributes.
length NUMBER,
width NUMBER,
area NUMBER,
-- Define a constructor that has only 2 parameters.
CONSTRUCTOR FUNCTION rect(length NUMBER, width NUMBER)
RETURN SELF AS RESULT
PROCEDURE G(obj1 in TESTTYPE1,obj2 out rect) as
n1 testtype;
n2 testtype;
n3 testtype;
n4 testtype;
begin
obj2 := NEW rect(10,20,200);
n1 := obj1.student1;
n2 := obj1.student2;
n3 := obj1.student3;
obj2.length :=20;
end;
=====================================================
I am not able to call the procedure in java code as I cannot figure out which out parameter type will it be registered using registeroutparameter. using cursor or struct type fails.
please let me know how I can pass values from stored procedure with objects to java.I'm not sure what you're trying to accomplish with your procedure, but in general, this is an example of how you could use oracle.sql.STRUCT.
First, prepare your java.sql.CallableStatement using java.sql.CallableStatement cStmt = java.sql.Connection.prepareCall({ call G(?, ?) });
Note that you don't have to use the OracleCallableStatement. The java.sql.CallableStatement will work just fine.
For the IN parameter, you need to create three TEST_TYPE objects. Then you need to create one TESTTYPE1 object.
These will all be instances of oracle.sql.STRUCT.
To create a oracle.sql.STRUCT object you need a descriptor and a set of attributes. For example, to create a TEST_TYPE object you would do the following
1. StructDescriptor sd = StructDescriptor.createDescriptor("TEST_TYPE", java.sql.Connection).
2. Add a VARCHAR2 attribute to an array of attributes (e.g. Object[] attributes = new Object[]{"Student Name"})
3. oracle.sql.STRUCT struct = new oracle.sql.STRUCT(sd, java.sql.Connection, attributes)
Then do something similar to create the TESTTYPE1 object, except that the attribute array will contain three instances of TEST_TYPE struct objects.
To bind the IN parameter you need to use the java.sql.CallableStatement.setObject(1, <Instance of TESTTYPE1 object>).
To register the OUT parameter, you need to call java.sql.CallableStatement.registerOutParameter(2, oracle.jdbc.OracleTypes.STRUCT, "RECT").
Then, execute your procedure using cStmt.execute();
Retrieve your OUT parameter using oracle.sql.STRUCT struct = (oracle.sql.STRUCT)cStmt.getObject(2).
Once you've done that, to get the values of the attributes of all of your STRUCT objects, you need their descriptors and their metadata. -
Error using BULK Collect with RECORD TYPE
hello
I have written a simple Procedure by declaring a record type & then making a variable of NESTED Table type.
I then select data using BULK COLLECT & tryin to access it through a LOOP.....Getting an ERROR.
CREATE OR REPLACE PROCEDURE sp_test_bulkcollect
IS
TYPE rec_type IS RECORD (
emp_id VARCHAR2(20),
level_id NUMBER
TYPE v_rec_type IS TABLE OF rec_type;
BEGIN
SELECT employee_id, level_id
BULK COLLECT INTO v_rec_type
FROM portfolio_exec_level_mapping
WHERE portfolio_execp_id = 2851852;
FOR indx IN v_rec_type.FIRST..v_rec_type.LAST
LOOP
dbms_output.put_line('Emp -- '||v_rec_type.emp_id(indx)||' '||v_rec_type.level_id(indx));
END LOOP;
END;
Below are the ERROR's i am getting ....
- Compilation errors for PROCEDURE DOMRATBDTESTUSER.SP_TEST_BULKCOLLECT
Error: PLS-00321: expression 'V_REC_TYPE' is inappropriate as the left hand side of an assignment statement
Line: 15
Text: FROM portfolio_exec_level_mapping
Error: PL/SQL: ORA-00904: : invalid identifier
Line: 16
Text: WHERE portfolio_execp_id = 2851852;
Error: PL/SQL: SQL Statement ignored
Line: 14
Text: BULK COLLECT INTO v_rec_type
Error: PLS-00302: component 'FIRST' must be declared
Line: 19
Text: LOOP
Error: PL/SQL: Statement ignored
Line: 19
Text: LOOP
PLZ Help.and with a full code sample:
SQL> CREATE OR REPLACE PROCEDURE sp_test_bulkcollect
2 IS
3 TYPE rec_type IS RECORD (
4 emp_id VARCHAR2(20),
5 level_id NUMBER
6 );
7 TYPE v_rec_type IS TABLE OF rec_type;
8 v v_rec_type;
9 BEGIN
10 SELECT empno, sal
11 BULK COLLECT INTO v
12 FROM emp
13 WHERE empno = 7876;
14 FOR indx IN v.FIRST..v.LAST
15 LOOP
16 dbms_output.put_line('Emp -- '||v(indx).emp_id||' '||v(indx).level_id);
17 END LOOP;
18 END;
19 /
Procedure created.
SQL>
SQL> show error
No errors.
SQL>
SQL> begin
2 sp_test_bulkcollect;
3 end;
4 /
Emp -- 7876 1100
PL/SQL procedure successfully completed. -
Error while creating function with record type as return type
Hi i tried the following code to get the nth highest sal using record type and function.
CREATE OR REPLACE PACKAGE pack_rec_cur AS
TYPE rec_type IS RECORD (
name EMP.ename%TYPE,
sal EMP.sal%TYPE);
END;The above package is created
CREATE OR REPLACE
FUNCTION fun_rec_cur(n INT) RETURN pack_rec_cur.rec_type AS
rec pack_rec_cur.rec_type;
CURSOR cur_rec IS
SELECT ename,sal
FROM emp
WHERE sal is not null
ORDER BY DESC;
BEGIN
OPEN cur_rec;
FOR i IN 1..n LOOP
FETCH cur_rec into rec;
EXIT WHEN cur_rec%NOTFOUND;
END LOOP;
CLOSE cur_rec;
RETURN rec;
END; The above function is giving errors
LINE/COL ERROR
4/7 PL/SQL: SQL Statement ignored
7/16 PL/SQL: ORA-00936: missing expression
SQL> Could you please correct me where i'm doing mistake
Thanks.You are missing the column name in order by clauase. Is it ename desc?
CREATE OR REPLACE
FUNCTION fun_rec_cur(n INT) RETURN pack_rec_cur.rec_type AS
rec pack_rec_cur.rec_type;
CURSOR cur_rec IS
SELECT ename,sal
FROM emp
WHERE sal is not null
ORDER BY ENAME DESC; ---added ename
BEGIN
OPEN cur_rec;
FOR i IN 1..n LOOP
FETCH cur_rec into rec;
EXIT WHEN cur_rec%NOTFOUND;
END LOOP;
CLOSE cur_rec;
RETURN rec;
END;
-OUTPUT
SQL> SET SERVEROUT ON
SQL>
SQL> DECLARE
2 rec pack_rec_cur.rec_type;
3 BEGIN
4 rec := fun_rec_cur (6); --you get the 6th record in order of ename desc
5 DBMS_OUTPUT.put_line ('ename::' || rec.NAME || ' sal ::' || rec.sal);
6 END;
7 /
ename::MARTIN sal ::1250
PL/SQL procedure successfully completed.
SQL> -
Dynamic table with field type table
Hi,
I´m using "cl_alv_table_create=>create_dynamic_table" to create a dynamic table for ALV Grid.
But...I need to use colors in ALV, then I need to declare a field type LVC_S_SCOL in dynamic table from "cl_alv_table_create=>create_dynamic_table".
How can I declare this in fieldcat?
The code:
Creating dynamic table
DATA: table_agrup TYPE REF TO data,
line_agrup TYPE REF TO data.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = t_fieldcat
IMPORTING
ep_table = table_agrup
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
ASSIGN table_agrup->* TO .
Printing ALV
CALL METHOD obj_grid->set_table_for_first_display
EXPORTING
is_variant = w_variant
i_save = 'A'
is_layout = w_layout
CHANGING
it_outtab =
it_fieldcatalog = t_fieldcat
it_sort = t_sort
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
Thanks.It is not possible with the METHOD cl_alv_table_create=>create_dynamic_table to include another table inside that newly generated table.
I have tried to do it with the code and I got the dynamic table created after at the end of the program.
In the code,
<DYN_TABLE> has same effect as your <table> variable
<DYN_WA> has same effect as your <HEADER>
REPORT ZTEST_NP_DYNAMIC.
DATA: DY_TABLE TYPE REF TO DATA,
DY_LINE TYPE REF TO DATA.
FIELD-SYMBOLS: <DYN_TABLE> TYPE STANDARD TABLE,
<DYN_WA>,
<DYN_FIELD>.
FIELD-SYMBOLS: <FS> TYPE ANY.
* To generate the Dyanmic table with the COLOR
DATA: LS_SOURCE TYPE STRING.
DATA: LT_SOURCE LIKE STANDARD TABLE OF LS_SOURCE WITH HEADER LINE.
DATA: L_NAME LIKE SY-REPID.
DATA: L_MESSAGE(240) TYPE C,
L_LINE TYPE I,
L_WORD(72) TYPE C.
DATA: L_FORM(30) TYPE C VALUE 'TABLE_CREATE'.
LT_SOURCE = 'REPORT ZTEST_SUBROUTINE_POOL.'.
APPEND LT_SOURCE.
LT_SOURCE = 'FORM TABLE_CREATE USING I_FS TYPE ANY.'.
APPEND LT_SOURCE.
LT_SOURCE = 'DATA: BEGIN OF LT_GENTAB OCCURS 0.'.
APPEND LT_SOURCE.
LT_SOURCE = 'DATA: BUKRS TYPE BUKRS. '.
APPEND LT_SOURCE.
LT_SOURCE = 'DATA: BKTXT TYPE BKTXT. '.
APPEND LT_SOURCE.
* you can add your fields here.....
LT_SOURCE = 'DATA: COLOR TYPE lvc_t_scol. '.
APPEND LT_SOURCE.
LT_SOURCE = 'DATA: END OF LT_GENTAB.'.
APPEND LT_SOURCE.
LT_SOURCE = 'DATA: POINTER TYPE REF TO DATA.'.
APPEND LT_SOURCE.
LT_SOURCE = 'CREATE DATA POINTER LIKE STANDARD TABLE OF LT_GENTAB.'.
APPEND LT_SOURCE.
LT_SOURCE = 'I_FS = POINTER.'.
APPEND LT_SOURCE.
LT_SOURCE = 'ENDFORM. '.
APPEND LT_SOURCE.
L_NAME = 'ZTEST_SUBROUTINE_POOL'.
CATCH SYSTEM-EXCEPTIONS GENERATE_SUBPOOL_DIR_FULL = 9.
GENERATE SUBROUTINE POOL LT_SOURCE NAME L_NAME
MESSAGE L_MESSAGE LINE L_LINE WORD L_WORD. "#EC CI_GENERATE
ENDCATCH.
IF NOT L_MESSAGE IS INITIAL.
MESSAGE E000(0K) WITH L_MESSAGE L_LINE L_WORD.
ENDIF.
ASSIGN DY_TABLE TO <FS>.
PERFORM (L_FORM) IN PROGRAM (L_NAME) USING <FS>.
ASSIGN DY_TABLE->* TO <DYN_TABLE>.
* Create dynamic work area and assign to FS
CREATE DATA DY_LINE LIKE LINE OF <DYN_TABLE>.
ASSIGN DY_LINE->* TO <DYN_WA>.
Write: 'bye'.
Regards,
Naimesh Patel -
Stored procedure with custom type failed from jdbc
DECLARE X Abp_Online_Dataselection.BULK_SCHEME_TAB; BEGIN Abp_Online_Dataselection.ABP_ONLINE_SCHEMESELECTION('BSWD','IN','NEW',X); FOR R IN X.FIRST .. X.LAST LOOP DBMS_OUTPUT.PUT_LINE(X(R).SCHEME_NAME); DBMS_OUTPUT.PUT_LINE(X(R).ISSUE); DBMS_OUTPUT.PUT_LINE(X(R).CURRENCY); DBMS_OUTPUT.PUT_LINE(X(R).PRICE); DBMS_OUTPUT.PUT_LINE(X(R).GIFT); END LOOP; END;
Here Abp_Online_Dataselection.ABP_ONLINE_SCHEMESELECTION is the stored procedure which I can run
in SQL client.
How can I access the result returned by this.
What I have tried is this
Connection conn = myservice.getPooledTestConnection(); CallableStatement cstmt = conn.prepareCall("{call Abp_Online_Dataselection.ABP_ONLINE_SCHEMESELECTION(?,?,?,?)}"); java.sql.Array recarray; cstmt.setString(1, "BSWD"); cstmt.setString(2, "IN"); cstmt.setString(3, "NEW"); cstmt.registerOutParameter(4, java.sql.Types.OBJECT); // What is the right type? if (cstmt.execute()) { }
This gives invalid column type exception.Normally it requires driver specific code.
If it was me I would wrap it in another proc and use a cursor (or whatever it takes) to traverse the result so it returns a normal result set to java.
Maybe you are looking for
-
ITunes 9 has corrupted my iPod Classic
So here is my sorry story - please let me know if you have had similar symptoms and if you have found a solution. I have a MacBook Pro, running Snow Leopard. I recently upgraded iTunes to iTunes version 9.0.2 and attempted to synchronise my iPod Clas
-
How to call webservices in webdynpro abap
Hi Experts, My requirement is I have to call an URL by exporting an XML file to that URL I have to import an XML file again i .e nothing but I have to send request file in the form of XML and need to get response in the form of XML file from the URL
-
I have an eMac. 1.25 GHz Power PC G4. OS 10.5.8. Why can't I find a Flash Plugin that will run my videos on Facebook etc?
-
Hi,i'm Mizanur Rahman,i want to buy poker chips from my iTunes account, but not do this when i want to buy that say "please contact iTunes support ti complete this transaction" for what is this i dunt understand this.plz solv this probleams.but i par
-
Folks, I am trying to build a PRO*C using SQLDA.h. - I'm trying to use SQLSQLDAAlloc() - I use the following code: sqlda = SQLSQLDAAlloc(SQL_SINGLE_RCTX, size,max_vname_len,max_iname_len); - SQL_SINGLE_RCTX is defined in SQLCPR.h as : #define SQL_SIN