How to get return type as Table of Index by BINAR from Procedure using JDBC
Hi,
We have stored procedure which takes Varchar as input and rerurn muiltiple recored of type Table of index by BINARY
We created the procedure with in a package, its header part like below:
CREATE OR REPLACE PACKAGE emp_pkid_pkg
AS
TYPE r_emp IS RECORD ( employe_profile_id NUMBER
, client_profile_id VARCHAR2(240)
, email VARCHAR2(240)
, terms_acp VARCHAR2(1)
TYPE tp_emp_profile IS TABLE OF r_emp INDEX BY BINARY_INTEGER;
PROCEDURE er_employe_prov_profile ( e_inxid employe_provision_instance.inxid%TYPE
, e_emp_recs OUT tp_emp_profile
END emp_pkid_pkg;
This procedure has body part, wich has origial business logic like below.
CREATE OR REPLACE PACKAGE BODY emp_pkid_pkg
AS
PROCEDURE pr_customer_prov_profile ( e_inxid employe_provision_instance.inxid%TYPE
, e_emp_recs OUT tp_customer_provision_profile
IS
CURSOR c_emp_prov_instance ( c_guid employe_provision_instance.guid%TYPE )
etc ...
END emp_pkid_pkg;
We could execute the below script from oracle client tool and get the response.
DECLARE
e_cust emp_pkid_pkg.tp_emp_profile;
BEGIN
emp_pkid_pkg.er_employe_prov_profile ( 'ef45t6543y98'
, e_cust
FOR i in e_cust.FIRST..e_cust.LAST LOOP
DBMS_OUTPUT.PUT_LINE ( e_cust(i).employe_profile_id
||'#'|| e_cust(i).client_customer_id
||'#'|| e_cust(i).email
||'#'|| e_cust(i).term_acp);
END LOOP;
END;
We have requirement to get the results from procedure usind JDBC callable statement call.
We have tried to call the procedure via JDBC callable statement but it didn't work.
We have constructed it like the following. It was throwing error "java.sql.SQLException: invalid column type: emp_pkid_pkg.tp_emp_profile
CallableStatement cs2 = con.prepareCall("{call emp_pkid_pkg.er_employe_prov_profile(?,?)}");
cs2.registerOutParameter(2, OracleTypes.CURSOR, emp_pkid_pkg.tp_emp_profile);
cs2.setString(1,empId);
Not sure whether I am doing the logic correctly. But i tryed with diff type. Still am getting same error like above.
Please point me to the correct approach.
Thanks
Edited by: 921689 on 18-Mar-2012 17:20
>
We have requirement to get the results from procedure usind JDBC callable statement call.
>
Can't be done - the reason has nothing to do with JDBC so you are in the wrong forum.
Repost in the PL/SQL forum and I can give you an example of what you have to do
PL/SQL
First the TYPEs you defined are PL/SQL types so can't be referenced outside PL/SQL; you need to define SQL types.
Second you will need to use a procedure that returns a REF CURSOR or is a PIPELINED procedure. Since your procedure doesn't fall into either category you can't use it with JDBC to do what you want.
If your query was a PIPELINED function then you could simply query it like it was a table. I have a PIPELINED function name 'get_emp' so this works.
select * from table(get_emp(30));Post in the PL/SQL forum and I can give you the code for the procedure. I'm not going to clutter up this forum with inappropriate material.
Similar Messages
-
How to get the Change Log Table name of the ODS from the system table
Hi,
I have a list of ODSs in the system and I am interested in finding the corresponding Change Log Table and the number of records in that table.
Can any one please tell me the name of the system table where this information is stored.
I dont want to get in this information manully (from the Contents tab of the ODS maintenane).
Regards,
Harikiran GunnalaHi
Go to SE16
Give the table name as "RSTSODS".
For User application field give CHANGELOG as input
and execute. You will get all the list of Changelog tables Along with below mentioned data
PSA
Version
To
Valid from
Object Status
Technical ODS name
Program Name
Maint Program
Object Name
Last changed by
UTC Time Stamp in Short Form
Partition number
Regards
Raj -
How to get the list of tables having index in particular tablespace
HI
can anyone help me with this
i need to display the list of tables that are having indexes in a particular tablespace(let it be A)
and the list of tables that are not having indexes in tablespace A.
thanks in advance...user8884944 wrote:
HI
can anyone help me with this
i need to display the list of tables that are having indexes in a particular tablespace(let it be A)
and the list of tables that are not having indexes in tablespace A.
thanks in advance...Use TABLESPACE_NAME, INDEX_NAME and TABLE_NAME columns of DBA_INDEXES view
[Kamran Agayev A. |http://kamranagayev.wordpress.com] (OCP 9i/10g)
Author of the upcoming book - *"Oracle Backup & Recovery: Expert secrets for using RMAN and Data Pump"*
http://www.rampant-books.com/book_1002_rman_backup_recovery.htm -
How to get wage type for every time record
Hi Pros,
I am using DS 0CA_TS_IS_1, it includes report time type (0REPTT), but not have wage type. in CATSDB, I fied fields for attendance/absence type and wage type. but not every time record has wage type. can you please tell me how to get wage type for every time record? what is relation between reporting time type, attendance/absence type and wage typs?Hello,
Can you talk to your HR/T&E functional consultant if they populate these values in CATSDB table using standard way or if there are custom fields that are in CATSDB OR any other table which can be used to meed the requirements
Thanks
Abhishek Shanbhigue -
Urgent : how I get tree type group total result
hi master
sir now system give me this type for result
PARENT ACCID DRBAL CRBAL
K1
K11
11 K1101 46291132
11 K1102 13182173
11 K1103 23784045
11 K1104
11 K1105
11 K1106
11 K1107 10001795
11 K1108 9083529
11 K1109
11 K1110 4224350
11 K1111
11 K1112 6696832
11 K1113 7963381
11 K1114 742766
1 K12
12 K1201 1486082
12 K1202
12 K1203
1 K13
13 K1301
1301 K130101
1301 K130102
1301 K130103
1301 K130104 1977616
1301 K130105
1301 K130106 736266
1301 K130107 396673
1301 K130108 42751
1301 K130109 298362
1301 K130110 187696
1301 K130111 537
1301 K130112 942
1301 K130113 987
1301 K130114 1272
1301 K130115 40000
13 K1302
1302 K130201
1302 K130202
1302 K130203
1302 K130204
1302 K130205 259941
13 K1303
1303 K130301
1303 K130302
1303 K130303 177716
13 K1304
1304 K130401
1304 K130402
1304 K130403
1304 K130404
1304 K130405
1304 K130406 809719
1304 K130407
1304 K130408 1786091
13 K1305
1305 K130501
1305 K130502
13 K1306
1306 K130601
13 K1311
1311 K131101 788780
K2
2 K21
21 K2101
2101 K210101
2101 K210104
21 K2102
2102 K210201
2102 K210202
22 K2205
2205 K220501
2205 K220502
220502 K22050201
220502 K22050202
220502 K22050203
220502 K22050204
22 K2206
2206 K220601
2206 K220602
but sir i need this type of result
PARENT ACCID DRBAL CRBAL
GROUP NAME K1
GROUP NAME K11
11 K1101 46291132
11 K1102 13182173
11 K1103 23784045
11 K1104
11 K1105
11 K1106
11 K1107 10001795
11 K1108 9083529
11 K1109
11 K1110 4224350
11 K1111
11 K1112 6696832
11 K1113 7963381
11 K1114 742766
TOTAL
1 K12
TOTAL
GROUP NAME
12 K1201 1486082
12 K1202
12 K1203
TOTAL
1 K13
13 K1301
1301 K130101
1301 K130102
1301 K130103
1301 K130104 1977616
1301 K130105
1301 K130106 736266
1301 K130107 396673
1301 K130108 42751
1301 K130109 298362
1301 K130110 187696
1301 K130111 537
1301 K130112 942
1301 K130113 987
1301 K130114 1272
1301 K130115 40000
13 K1302
1302 K130201
1302 K130202
1302 K130203
1302 K130204
1302 K130205 259941
13 K1303
1303 K130301
1303 K130302
1303 K130303 177716
13 K1304
1304 K130401
1304 K130402
1304 K130403
1304 K130404
1304 K130405
1304 K130406 809719
1304 K130407
1304 K130408 1786091
13 K1305
1305 K130501
1305 K130502
13 K1306
Sir I need total group by group father group total and child group total
Please help me how I get tree type group total resultHi master
thankyou for your reply
Sir,
i know and you see my working i get code form master table and get detal amount form other table
I have two table see table
Acctab Baltab
PARENT PCID
CHILD title
PCID amount
I need heretical result use this type of query but not success
please see my query and give me idea how I get here full tree
select test.child,test.pcid,baltab.pcid from (select acctab.child,acctab.parent,acctab.pcid
from acctab
start with acctab.parent is null
connect by prior acctab.child= acctab.parent) test,baltab
where test.pcid=baltab.pcid ;
CHILD PCID PCID
1 1 1
2 2 2
3 3 3
11 111 111
12 112 112
13 113 113
21 221 221
22 222 222
23 223 223
31 331 331
32 332 332
33 333 333
but I need this type result
CHILD PCID
1 1
11 111
12 112
13 113
2 2
21 221
22 222
23 223
3 3
31 331
32 332
33 333 -
Reg: how to get notification type QMART
Hi experts,
how to get notification type QMART
BAPI_DOCUMENT_GETLIST2..
regards,
ramesh..Hi
Get the same from <b>QMEL table
Master table is TQ80
and texts are TQ80_T</b>
Reward points if useful
Regards
Anji -
How to get return value from Java runtime.getRuntime.exec?
I'm running shell commands from an Oracle db (11gr2) on aix.
But, I would like to get a return value from a shell comand... like you get with "echo $?"
I use a code like
CREATE OR REPLACE JAVA SOURCE NAMED common."Host" AS
import java.io.*;
public class Host {
public static int executeCommand(String command) {
int retval=0;
try {
String[] finalCommand;
finalCommand = new String[3];
finalCommand[0] = "/bin/sh";
finalCommand[1] = "-c";
finalCommand[2] = command;
final Process pr = Runtime.getRuntime().exec(finalCommand);
pr.waitFor();
catch (Exception ex) {
System.out.println(ex.getLocalizedMessage());
retval=-1;
return retval;
/but I do not get a return value... because I don't know how to get return value..
Edited by: user9158455 on 22-Sep-2010 07:33Hi,
Have your tried pr.exitValue() ?
I think you also need a finally block that destroys the subprocess
Regards
Peter -
How to get all rows in table to red using alternate rows properties option
How to get all rows in table to red using alternate rows properties option
Hi Khrisna,
You can get all rows red by selecting the color red in the "Color" and "frequency" to 1 under the "Alternate Row/Column colors".
I tried doing it and the colors freaked me out (all red) :-D
Kindly tell me if im missing something.
Regards,
John Vincent -
How to get data type of variable in program..
Hi ABAP Guru.
I need to know how to get data type of variable or any structure field.. because I got short dump when use command REPLACE ALL OCCURANCE ... with variable/structure field that has data type I or P, I think it should be used with data type CHAR only, So I need to check the data type first.
Please give me your advice
Thank you all.
Nattapash C.data : v_value type i,
v_char(10) type c.
v_value = 10.
move v_value to v_char.
REPLACE ALL OCCURRENCES of '#' from v_char....
Best regards,
Prashant -
How to specify the type of table in the form parameters
How to specify the type of table in the form parameters. for example, how to specify the type of table "vacancies".
FORM getcertainday
USING
vacancies TYPE STANDARD TABLE
efirstday LIKE hrp9200-zfirst_day
lfristday LIKE hrp9200-zfirst_day.Hi
Are you asking about subroutine program to declare a variable for perform statement etc
if it so check this coding
DATA: NUM1 TYPE I,
NUM2 TYPE I,
SUM TYPE I.
NUM1 = 2. NUM2 = 4.
PERFORM ADDIT USING NUM1 NUM2 CHANGING SUM.
NUM1 = 7. NUM2 = 11.
PERFORM ADDIT USING NUM1 NUM2 CHANGING SUM.
FORM ADDIT
USING ADD_NUM1
ADD_NUM2
CHANGING ADD_SUM.
ADD_SUM = ADD_NUM1 + ADD_NUM2.
PERFORM OUT USING ADD_NUM1 ADD_NUM2 ADD_SUM.
ENDFORM.
FORM OUT
USING OUT_NUM1
OUT_NUM2
OUT_SUM.
WRITE: / 'Sum of', OUT_NUM1, 'and', OUT_NUM2, 'is', OUT_SUM.
ENDFORM.
If your issue is some other can u explain me clearly
Regards
Pavan -
How to get value on the table control in infotyp e0008
Dear Freinds
I have written a user exit ZXPADU02 for my requirement
as per the requirement in i have calculated wa-poo8-bet01 = wa_p0008-ansal/12 and i have passed on to the INNNN structure .
Nowe when do a Create or Copy for a rcord in infotype 0008 iam not
getting value on Q0008-betrg field on the SCREEN , since it is table control how to get data on the table Control Cell .
Please let me knlow
regardsHi Syamala,
The try to find the name of the table control and pass the values to it.
Of course you have to loop and endloop, the table control and mofidy it from the work area.
Message was edited by:
Sera -
How to get File type icon for files store on Amazons3
Hi,
i want to know about how to get file type icons for files that we store on Amazons3.i am a devloper ,i want to make gui for accessing amazons3.
so ,i want to know about how to get file type icons for files that we store on Amazons3.
thanx in advance.hi,
have u heard amazon simple storage service,that provides storage space for
storing files, i am a devloper,i want to know the files that we store on amazon,how we can get file type icon for that files.
i want to sample code in java for this.
thanx in advance. -
How about get item count of table in formGroup.vm
JHeadstart Team:
I want change maxColumns=" 1" or" 2" by item count of table .but I do not know how about get item count of table .
#if (${JHS.current.group.columns} > 10)
#set ($majin = 2)
#else
#set ($majin = 1)
#end
<af:panelForm rows="1" maxColumns="$majin" width="${JHS.current.group.formWidth}" id="${JHS.current.group.shortName}FormItems">
majin
#FORM_ITEMS()
</af:panelForm>You can do this using the following syntax:
#if (${JHS.current.itemContainer.items.size()}>10)
maxColumns="2"
#else
maxColumns="1"
#end
Steven Davelaar,
Jheadstart Team -
How to get the most current file based on date and time stamp using SSIS?
Hello,
Let us assume that files get copied in a specific directory. We need to pick up a file and load data. Can you guys let me know how to get the most current file based on date and time stamp using SSIS?
Thanks
thx regards dinesh vvhi simon
i excuted this script it is giving error..
Microsoft SQL Server Integration Services Script Task
Write scripts using Microsoft Visual C# 2008.
The ScriptMain is the entry point class of the script.
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;
namespace ST_9a6d985a04b249c2addd766b58fee890.csproj
[System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
#region VSTA generated code
enum ScriptResults
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
#endregion
The execution engine calls this method when the task executes.
To access the object model, use the Dts property. Connections, variables, events,
and logging features are available as members of the Dts property as shown in the following examples.
To reference a variable, call Dts.Variables["MyCaseSensitiveVariableName"].Value;
To post a log entry, call Dts.Log("This is my log text", 999, null);
To fire an event, call Dts.Events.FireInformation(99, "test", "hit the help message", "", 0, true);
To use the connections collection use something like the following:
ConnectionManager cm = Dts.Connections.Add("OLEDB");
cm.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorks;Provider=SQLNCLI10;Integrated Security=SSPI;Auto Translate=False;";
Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
To open Help, press F1.
public void Main()
string file = Dts.Variables["User::FolderName"].Value.ToString();
string[] files = System.IO.Directory.GetFiles(Dts.Variables["User::FolderName"].Value.ToString());
System.IO.FileInfo finf;
DateTime currentDate = new DateTime();
string lastFile = string.Empty;
foreach (string f in files)
finf = new System.IO.FileInfo(f);
if (finf.CreationTime >= currentDate)
currentDate = finf.CreationTime;
lastFile = f;
Dts.Variables["User::LastFile"].Value = lastFile;
Dts.TaskResult = (int)ScriptResults.Success;
thx regards dinesh vv -
How to assign Values to nested table and pass as parameter to procedure?
How to assign Values to nested table and pass as parameter to procedure?
Below is the Object and its type
create or replace type test_object1 as object
val1 varchar2(50),
val2 varchar2(50),
val3 varchar2(50)
create or replace type test_type1 is table of test_object1;
create or replace type test_object2 as object
val1 varchar2(50),
val2 varchar2(50),
val3 varchar2(50)
create or replace type test_type2 is table of test_object2;
GRANT ALL ON test_object1 TO PUBLIC;
GRANT ALL ON test_type1 TO PUBLIC;
GRANT ALL ON test_object2 TO PUBLIC;
GRANT ALL ON test_type2 TO PUBLIC;
here is the table made of object type:
create table test_object_tpe
sl_num NUMBER,
description VARCHAR2(100),
main_val1 test_type1,
main_val2 test_type2
NESTED TABLE main_val1 STORE AS tot1
NESTED TABLE main_val2 STORE AS tot2;
here is the procedure which inserts values into nested table:
PROCEDURE INSERT_TEST_DATA(sl_num IN NUMBER,
description IN VARCHAR2,
p_main_val1 IN test_type1,
p_main_val2 IN test_type2
IS
BEGIN
FOR rec in p_main_val1.first..p_main_val1.last
LOOP
INSERT INTO xxdl.test_object_tpe
sl_num,
description,
main_val1,
main_val2
VALUES
sl_num
,description
,test_type1 (test_object1(
p_main_val1(rec).val1,
p_main_val1(rec).val2,
p_main_val1(rec).val3
,test_type2 (test_object2( p_main_val2(rec).val1,
p_main_val2(rec).val2,
p_main_val2(rec).val3
END LOOP;
commit;
END INSERT_TEST_DATA;
here is the anonymoys block which assigns values to the object type and pass values into the procedure:
set serveroutput on;
declare
p_sl_num NUMBER := 1001;
p_description VARCHAR2(50) := 'Testing Val1';
inval1 test_type1 := test_type1();
inval2 test_type2 := test_type2();
begin
inval1(1).val1 := 'testx1';
inval1(1).val2 := 'testx2';
inval1(1).val3 := 'testx3';
inval2(1).val1 := 'testy1';
inval2(1).val2 := 'testy2';
inval2(1).val3 := 'testy3';
CSI_PKG.INSERT_TEST_DATA(sl_num => p_sl_num,
description => p_description,
p_main_val1 => inval1,
p_main_val2 => inval2
end;
Can anybody correct me.
Thanks,
LavanThanks for posting the DDL and sample code but whenever you post provide your 4 digit Oracle version (result of SELECT * FROM V$VERSION).
>
How to assign Values to nested table and pass as parameter to procedure?
>
Well you are doing almost everything wrong that could be done wrong.
Here is code that works to insert data into your table (the procedure isn't even needed).
declare
p_sl_num NUMBER := 1001;
p_description VARCHAR2(50) := 'Testing Val1';
inval1 test_type1 := test_type1();
inval2 test_type2 := test_type2();
begin
inval1.extend();
inval1(1) := test_object1('testx1', 'testx2', 'testx3');
inval2.extend();
inval2(1) := test_object2('testy1', 'testy2', 'testy3');
INSERT INTO test_object_tpe
sl_num,
description,
main_val1,
main_val2
VALUES
(p_sl_num, p_description, inval1, inval2);
commit;
end;
/See Example 5-15 Referencing a Nested Table Element in Chap 5 Using PL/SQL Collections and Records in the PL/SQL doc
http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/collections.htm#CJABEBEA
1. You don't even need the procedure since all it does is a simple INSERT into the table which you can do directly (see my code above)
inval1(1).val1 := 'testx1';There is no element one (1) of 'inval1' since you haven't created any elements yet. You need to EXTEND the collection to add an element
inval1.extend();And then there is an empty element but 'inval1' is a container for objects of type 'test_object1' not for scalars like 'val1', 'val2', and 'val3'.
So you can't do
inval1(1).val1 := 'testx1';You have to create an instance of 'test_object1'
inval1(1) := test_object1('testx1', 'testx2', 'testx3');And so on for the other collection
You don't need the procedure (as my sample code shows) but once you populate the variables properly it will work.
Maybe you are looking for
-
Hello, i have been using mac for a long time and bought a Mbp 1 year ago, but i am facing a big probleme atm and hope some of you could help me. To make a long story short i like gaming and want to plug my macbook pro into a screen i had a look at th
-
Bounding box for selecting components
Hi, in my application i have to implement a bounding box to select some displayed components (panels or icons). I have searched for a JAVA-technique for bounding boxes, but i did not found anything. Does anybody know a JAVA-API that supports bounding
-
Error when passing URL from OLAP Universe to WebI
Hi Experts, I am getting 'The Supplier XML is not valid' WebI error when passing a URL from OLAP Universe. URL example: '<a href="http://www.sap.com">web link</a>' I follow Universe Designer Guide: - typing above URL into Dimension Select statement -
-
GOUP BY/SUM???????
Hello, Problem with JOIN and GROUP BY.................. This fields I would like to see in my output. THEY containt "XX-0000" same thing for sub, month,,,,etc SELECT t. EN_ENTITY_LNG, u. SA_SUB_LNG, v. COST_CTR_LNG, w. ACCT_DESC , y. gl_eff_dt, z. FI
-
Disp+work.exe yellow and not started
Dear experts ; i had an error after upgrading my ECC 6 kernel from 169 to patch level 185 and the below the DEV_DISP trc file: "dev_disp", trc level: 1, release: "700" sysno 80 sid SP2 systemid 562 (PC with Windows NT) relno 7000 p