How to call a procude in oracle and return an array
I need to call a procedure and return an array, can give some example code?
First create ArrayDescriptor
like:
public ArrayDescriptor createDescriptor(Connection con, String typename) throws SQLException
if(typename==null)
return null;
//WARNING! typename should be in upper case only! Otherwise Exception "invalid name pattern"
//will be thrown!
return ArrayDescriptor.createDescriptor(typename.toUpperCase(),con);
}Then use SetArray function to a prepared query (just like SetInt() or
SetString()):
public void setArray(PreparedStatement st, int index, Object [] value, ArrayDescriptor ad) throws SQLException
ARRAY array = new ARRAY(ad, st.getConnection(), value);
if(st instanceof OraclePreparedStatement)
OraclePreparedStatement opst=(OraclePreparedStatement )st;
opst.setArray(index, array);
else
throw new SQLException("Oracle JDBC driver required to support setArray() operation!");
}In the same way you could implement RegisterOutParameter() which
accepts Array - it's provided by class OraclePreparedStatement...
look Oracle JDBC manuals - everything is there.
Enjoy!
Paul
Similar Messages
-
How to create xml file from Oracle and sending the same xml file to an url
How to create xml file from Oracle and sending the same xml file to an url
SQL/XML (XMLElement, XMLForest, XMLAgg, etc) and UTL_HTTP.
Whether that works for you with the version of Oracle you have, your requirements, and needs is another story. A little detail goes a long way. -
How to call Sri Lanka mobile phones and land-lines...
How to call Sri Lanka mobile phones and land-lines from skype? When i am in overseas how to use skype to call to Sri Lanka mobile phones and land-lines? Can i know the process, how to get skype credit?, how to get subscriptions?, what are the rates for mobile phones and land-lines?
CajoTech wrote:
Were unable to call corporative landline numbers in Finland (010 and 020 numbers). We have 1 package for landline calls inside finalnd and the other one for making calls to mobile phones. Any idea what else do we need?
Hello and welcome to the Skype Community.
Your account shows that you have an Unlimited World Subscription which includes calls to private landlines in Finland. Your Subscription does not include calls to corporate landlines or to cellphones in Finland. To call corporate landlines you need to Buy Skype credit and to call cellphones either credit or a specific Skype subscription
TIME ZONE - US EASTERN. LOCATION - PHILADELPHIA, PA, USA.
I recommend that you always run the latest Skype version: Windows & Mac
If my advice helped to fix your issue please mark it as a solution to help others.
Please note that I generally don't respond to unsolicited Private Messages. Thank you. -
Trying to fetch a value in a java function and returning the array.
hello....I am trying to fetch a value in a java function and returning a array......I already write the pl/sql function which is working fine....but i think i m lost......when i run it through the jsp it shows me error........pls help
java code:=
public String [] viewx(String bid) throws SQLException, Exception {
String [] values;
try {
CallableStatement cstmt = null;
String SQL = "{?=call vi_dis.v_dis(?)}";
cstmt = con.prepareCall(SQL);
cstmt.registerOutParameter(1,Types.ARRAY);
cstmt.setString(2, bid);
cstmt.execute();
Array simpleArray = cstmt.getArray(1);
values = (String [])simpleArray.getArray();
cstmt.close();
} catch (SQLException sqle) {
error = "SQLException: Could not execute the query.";
throw new SQLException(error);
} catch (Exception e) {
error = "An exception occured while retrieving emp.";
throw new Exception(error);
return values;
pl/sql function
create or replace package vi_dis
as
function v_dis(vbid IN student.bid%type) return stuarray ;
end;
create or replace
package body vi_dis
as
function v_dis(vbid IN student.bid%type) return stuarray
is
l_stu stUarray :=stuarray();
cursor c_sel
is
SELECT CNAME
FROM COURSE C,ENROLL E
WHERE C.CID=E.CID
AND E.BID=vbid;
BEGIN
OPEN c_sel;
FETCH c_sel BULK COLLECT INTO l_stu;
l_stu.extend;
CLOSE c_sel;
RETURN l_stu;
EXCEPTION
WHEN NO_DATA_FOUND
THEN DBMS_OUTPUT.PUT_LINE('NO RESULT AVAILABLE');
CLOSE c_sel;
END;
END;
/BalusC wrote:
It is comparing the selected value against the List<SelectItem> returned by getSetoresOrigem() as it is during the apply request values phase of the form submit request.Ok. That's what I supposed JSF was doing.
BalusC wrote:
If the selected value isn't in there, then you will get this error.I can understand this, but is this right? As I said, the old value isn't really there because I changed the list values to new ones. But the new value (the value of fSetorOrigem ) corresponds to a value that exist in the new list items, so a valid value. So JSF is not considering that I also changed the list, not just the value. It is comparing the new value with the old list, not the new one. Acting like this JSF is making the page looks like a static HTML page, not a dynamic one. If I can't change the list and the value, what's the point of that? In my point of view I'm not doing anything wrong, I'm not violating any JSF rules.
Marcos -
How to call a package in Oracle
I'm trying to call a package in oracle
(this is the oracle way of calling it :
begin pck$xl.get_year_low_high_to_date(:compid, 20010801 , 20020108 ",:year_low,:year_high,:year_average,:low_date,:high_date); end;)
but i can't get it right.
I'm new to package calling in Oracle from Java, till now i only worked with SQL statements without parameters of that kind, can someone help me with this?
ps the ":compid" is a parameter i have to fill in and provide...
thank you very muchok here is a test i do...
but still doesn't work something about the bindvariables (check errorlog). I know a bit jdbc and i understant what you mean, but the problem is i don't know how this should go :(
please advise
import java.sql.*;
import java.util.*;
import java.text.*;
import java.io.*;
* @author U97488
public class test {
public static void main(String[] args) {
try{
ConnectionSherpa cs = ConnectionSherpa.getInstance("ConnectionSherpa");
Connection conn = cs.getConnObj();
String sSQL = "begin?; pck$xl.get_year_low_high_to_date(?, 20010801, 20020801 ,:year_low,:year_high,:year_average,:low_date,:high_date); end;";
CallableStatement stmt = conn.prepareCall(sSQL);
stmt.setString(1, "BRU10");
System.out.println(stmt.toString());
if(stmt.execute(sSQL)){
System.out.println(stmt.getString(2));
}catch (Exception e){
e.printStackTrace();
}StackTrace:
java.sql.SQLException: ORA-06550: Regel 1, kolom 6:
PLS-00110: Bindvariabele '1' is niet toegestaan in deze context..
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1451)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:862)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1839)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1764)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2354)
at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:909)
at com.kbcsecurities.taminoupdate.servlets.test.main(test.java:28) -
How to call a calander in oracle forms6i
Oracle Forms 6i
Hai All
How to call a calander for a botton.I my form I have a button called process date When i press a button the calander need to display and select a date and i need to the process date. How can i do this Pls tell Me
Any help is higly Appricateable
Thanks & Regards
Srikkanth.MHello,
In the forms 6i the installation contains the demo form. In that demo form you can see the calender example and many more. It is very easy to implement through demo form. Otherwise see the below link its java based.
Calendar utility in Forms?
Also this link...
http://www.oracle.com/technology/sample_code/products/forms/extracted/calendar/readme.html
-Ammad
Edited by: Ammad Ahmed on Apr 19, 2010 9:04 AM
Link added -
How to call java function in Oracle forms?
Hi I am having Oracle 9i with 10g Developer Suite.
I am new to Oracle forms..
I had one function in java getDatas()..
How can I call this function in Oracle Forms..
Pls help
ThanksThanks Francois,
I want to display values from my java code in the Forms..
For that purpose only i am installing 10g Developer Suite..
The below is java code..
public class DBTest {
public static String callDB(int id,String name){
String ss="Hai";
Connection con=null;
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection("url","id","pwd");
Statement st=con.createStatement();
System.out.println("Connected...");
int r=st.executeUpdate("Insert into FORM_TEST VALUES('"+id+"','"+name+"')");
if(r==1){
ss="Inserted Sucessfully";
else{
ss="Insertion Failed";
}catch(final Exception e){
System.out.println(e);
return ss;
public static void main(String[] args) {
int empid=102;
String empname="Gilbert";
String resultStr=callDB(empid,empname);
System.out.println(resultStr);
I want to dispaly Inserted or Insertion Failed in Oracle Forms..
As per Gerd Volberg suggestion, i had placed DBTest.jar in
E:\DevSuite\forms\java\DBTest.jar
and in formsweb.cfg the below jar is added..
archive_jini=frmall_jinit.jar,DBTest.jar
But in Fomrs Builder-->Program-->Import Java Classes-->Oracle
org,ice,com and subnodes are available.
But my jar is not available..
Is my way is coorect?
Pls provide soln..
Thanks -
How to call plsql procedure or function and getting back the string?
Hi Everyone,
i am using Jdev 11.1.1.5.0.
i have a requirement to call plsql procedure or function from my backing bean java file and get back the returned value from the procedure or function.
what piece of simple code i need to write in my backing bean?
please suggest.
Thanks.As always you write the method to call he pl/sql in the application module, expose this method to the client (so you see it in the datacontroll) then create a operation binding to the method and call this operation from the bean. The result you get by operation.getResult();
You should never call pl/sql from the bean directly!
The doc shows how to call the procedure from an application module: http://docs.oracle.com/cd/E21764_01/web.1111/b31974/bcadvgen.htm#sm0297
Timo -
How to call Report 6i/9i Oracle Standard Report into Discoverer 10g
How to call Report 6i Standared report into Duscoverer 10g as there is a requirement to create or transfer Oracle Standard report into Discoverer.
1) Account Analysis Subledger Details(180 Char) - Standard Report 6i as i want the same report in Discoverer 10g.
2) Aging Report -- 7 bucket --Standard report in 6i,how to transfer in Discoverer 10g.
Is is possible to Transfer from Report 6i to Discoverer or How to Create this report in Discoverer 10g.
Please advice,
SushantWell, if I had to do it, here's how I'd start.
1. Get the SQL from the Oracle Report and then create a database view that's more generic based on the SQL but still gets the answers.
For example, you'd not code many conditions, etc. but the database view would be pointing to the correct Oracle Apps tables / views.
Once you've got the view, bring it in to Disco Admin, etc. and create a report from it that now adds the extra conditions needed. That way you can use the underlying concept without hard coding things like dates, etc. which you would ask the user at run time.
However ... as you may well know ... Oracle Reports can do some 'strange and/or powerful things' on the fly and, for example, it may be something like a temporary table generated for the report, etc. so may become a much bigger issue.
2. If you have NoetixViews views then they'll most likely already have the views for these queries already created as they're reasonable for what's needed in an Oracle environment.
3. I'd see if there is already a pre-defined BIS view that covers this as well. Again, you're in an area that's pretty popular so if a BIS view already covers much of the same info then you've got a create view 'head start' already. Check views owned by Apps starting with the application plus FV or FG (the one you'd really want) such as: GLFG_Budgets_To_Actuals to see what I mean.
Russ -
How to call web services from oracle database 10g
Hi all ,
How can i call web services from oracle database 10g ?
thanks ...abdou123 wrote:
but how can i get complex result
for example
i pass input parameter like National Id Number
and get the person details ( name , age , date of birth , ............ ) .Basic approach to web services using UTL_HTTP explained in {message:id=10448611}.
An example of using a pipeline table function as a data transformation process (turning web data into rows and columns) in {message:id=10158148}. -
How to call Reader when both Acrobat and Reader are installed?
In my machine, I have both Acrobat 7.0 Standard and Acrobat Reader 8 installed.
I want to call Reader 8 in my program. But everytime it opens Acrobat 7.0. I use the following code,
Dim acroApp As Acrobat.CAcroApp
acroApp = CreateObject("AcroExch.App")
acroApp.MenuItemExecute("About")
I am new to writing PDF programs. Can anyone tell me how to call Reader 8 by program? (I'm using VB.Net.)You can use this code with Adobe Acrobat, not Adobe Reader.
Thank you for your reply. Does the library automatically choose application to call? or the library work under Acrobat only?
I tried to run the samples of IAC in Acrobat SDK, but all of them called Adobe Acrobat.
I'm really confused. Could you show me a way to call Reader? -
How to call database procedure in oracle forms
Hi,
Can anyone describe me that how I'll call database procedure in oracle forms (6i,10g)?
Thanks in Advance.
BalochHi Francois,
As I created a procedure in database as below
create or replace procedure For_table (tbl_of in number,st_pnt in number,en_pnt in number) is
begin
for i in st_pnt..en_pnt loop
dbms_output.put_line(tbl_of||'*'||i||'='||tbl_of*i);
end loop;
end For_table;
The above procedure is working fine when I'm using PL/SQL. I call the above procedure as
begin
For_table(3,5,20);
end;
but nothing happen
Thanks in Advance.
Baloch -
How to create database link between oracle and SQL Server
Hello Everyone,
Here i have Oracle Database 9i and SQL Server 2005 databases.
I have some tables in sql server db and i want to access from Oracle.
How to create a database link between these two servers
Thanks,Thanks for Everyone,
I was struggle with this almost 10 days....
I created Database link from Oracle to SQL Server
Now it is fine.........
Here i am giving my servers configuration and proceedure how i created the db link...@
Using Generic Connectivity (HSODBC) we can create db link between Oracle and SQL server.
Machine (1)
DB Version : Oracle 9.2.0.7.0
Operating System : HP-UX Itanuim 64 11.23
IP : 192.168.0.31
Host : abcdbt
Machine (2)
Version : SQL Server 2005
Operating System : Windows server 2003 x86
IP : 192.168.0.175
Host : SQLDEV1
User/PW : sa/abc@123! (Connect to database)
Database : SQLTEST (exsisting)
Table : T (“ T “ is the table existing in SQLTEST database with 10 rows)
Prerequisites in Machine (2):
a) Oracle 10g software
b) User account to access SQL Server database (sa/abc@123!)
c) Existing SQL Server Database (SQLTEST)
d) Tables (testing purpose) (T)
Steps:
1) Install Oracle 10.2.0.1 (Only SW,No need of database) *(Machine 2)*
2) Create a DSN where your windows Oracle 10g SW resides *(Machine 2)*
Control panel >> Administrative Tools >> Data Source (ODBC) >> System DSN ADD
You can follow this link also.....
http://www.databasejournal.com/features/oracle/article.php/3442661/Making-a-Connection-from-Oracle-to-SQL-Server.htm
I created DSN as
DSN name : SQLTEST
User : SA/abc@123! (Existing user account)
Host : 192.168.0.175 (machine 2)
Already I have 1 database in SQL Server with the name SQLTEST
You can create DSN with different name also (not same as db name also)
3) Create a hsodbc init file in $ORACLE_HOME\hs\admin *(Machine 2)*
Create init<DSN NAME> file
Ex: initSQLTEST
Copy inithsodbc to initSQLTEST
And edit
initSQLTEST file
HS_FDS_CONNECT_INFO = SQLTEST <DSN NAME>*
HS_FDS_TRACE_LEVEL = OFF*
save the file....@
4) Configure Listener.ora *(Machine 2)*
LISTENER_NEW =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.175)(PORT = 1525))
SID_LIST_LISTENER_NEW =
(SID_LIST =
(SID_DESC =
(SID_NAME = SQLTEST) *+< Here SQLTEST is DSN NAME >+*
(ORACLE_HOME = G:\oracle 10g\oracle\product\10.2.0\db_1)
(PROGRAM = hsodbc))
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = G:\oracle 10g\oracle\product\10.2.0\db_1)
(PROGRAM = extproc) )
:> lsnrctl start LISTENER_NEW
5) Configure tnsname.ora *(Machine 2)*
SQLTEST11 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.175)(PORT = 1525))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = SQLTEST))
(HS=OK)
:> tnsping SQLTEST11
If No errors then conti….
6) Configure a file *(Machine 1)*
Cd $TNS_ADMIN ($ORACLE_HOME/network/admin)
Create a file
$ vi TEST_abcdbt_ifile.ora
something=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST =192.168.0.175) (PORT=1525))
(CONNECT_DATA=
(SID=SQLTEST))
(HS=OK)
$ tnsping something
$ sqlplus system/manager
Your connected to Oracle database *(machine 1)*
create database link xyz connect to “sa” identified by “abc@123!” using ‘SOMETHING’;
select * from t@xyz;10 rows selected.
Thanks,
Edited by: ram5424 on Feb 10, 2010 7:24 PM -
How do call c++program in oracle
how do I call c++ program in oracle?
how do I store results which c++ program produce to oracle database?(eg:results could be some pictures,variable)If you are using Oracle9i release, there is the new OCCI (Oracle C++ Call Interface). You can use the 'Oracle Call Interface' forum to post your additional questions.
Regards,
Geoff
how do I call c++ program in oracle?
how do I store results which c++ program produce to oracle database?(eg:results could be some pictures,variable) -
How to Call Report RBDMON00/ Tcode BD87 and copy output in to externel DB
Hello,
for a student project y have to to write the output of some ABAP Reports and Function Modulesin an externel Database.
This time its about the Transaction Code "bd87" programmname "RBDMON00".
I've tried to write an RFC Function Module which calls the programm with:
SUBMIT RBDMN00
EXPORTING LIST TO MEMORY AND RETURN.
CALL FUNCTION 'LIST_FROM_MEMORY'
CALL FUNCTION 'LIST_TO_ASCI'
But theres always an exception Raise in the Function 'LIST_FROM_MEMORY' that theres nothign in the List.
I don't understand why, with other reports it works great.
Or is there any other way the get the output from Tcode bd87.
Is ther any body outher who can help me?
Thank you very.
Greets
JPSorry I'm realy new in SAP and ABAP, can you show me an example how to read out the the Idoc headers out of EDIDC table.
Or is there any other way to get the entries for example from the table "IDoc entries in tRFC queue" and the other tables behind bd87?
thanks for your patience.
Maybe you are looking for
-
I am reloading Photoshop CS2 and I can't get it activated. How is this to be done?
I am reloading Photoshop CS2 and I can't get it activated. How is this to be done?
-
How to write output to file in flash
hi all experts. I want to monitor a specific link. Lets say when it goes down, i want to write the following to a file in flash called link_mon.txt link down <show clock output> When it gets back up link up <show clock output> I know how to write the
-
Convert docx to pages in iCloud
I have lots of docx files on my MacBook Air. I want to be able to upload them to iCloud, but have them in Pages format. I can easily put them on iCloud. How do I convert them to Pages so I can see them on my iPhone?
-
The bar is now an ugly 70s green and serves no greater purpose than helping these unworthy mouthbreathers remember what tlc show they were watching. I have no interest in wasting even minutes of my life undoing the terribad change you made to firefox
-
Create Sales order using ORDERS05 idoc
Hi Experts, i need to create sales order from an external system using Idocs. we are using ORDERS05. We needs to save data in some custom fields. hence we have extended the idoc. But the Z* fields are not at the screen level. The function module 'I