PHP Oracle Object
Hi all,
I've a PHP script which needs to call a Stored Procedure that returns an Oracle Object.
Does anyone know how to access the returned object information. I haven't found any example of this. Is it possible?
Thanks
Davide Cecchetto
I've been trying to find this also and I believe
there's no such interface (tho I'd be delighted
to be shown wrong). Similarly, regarding VARRAYS
and SQL TABLE types, I think these'll work if
they're VARRAY or SQL TABLE of a simple scalar
type (number or char) but not if they're VARRAY
or SQL TABLE of a SQL object.
The only (crude) workaround that'll help some
people is to "explode" the object within your
PL/SQL block as called from PHP, like the below
code, which ends up having a bind variable or
each attribute of the object...
<?php
$sql =
"declare ".
" mo my_object;".
"begin"
" my_proc(mo); -- my_proc has an out parameter of type my_object".
" :attr1 := mo.a_attr;".
" :attr2 := mo.a_attr;".
" :attr3 := mo.a_attr;".
"end;".
?>
Similar Messages
-
How to return Values from Oracle Object Type to Java Class Object
Hello,
i have created an Oracle Object Types in the Database. Then i created Java classes with "jpub" of these types. Here is an example of the type.
CREATE OR REPLACE TYPE person_type AS OBJECT
ID NUMBER,
vorname VARCHAR2(30),
nachname VARCHAR2(30),
geburtstag DATE,
CONSTRUCTOR FUNCTION person_type RETURN SELF AS RESULT,
CONSTRUCTOR FUNCTION person_type(p_id NUMBER) RETURN SELF AS RESULT,
CONSTRUCTOR FUNCTION person_type(p_vorname VARCHAR2,
p_nachname VARCHAR2,
p_geburtstag DATE) RETURN SELF AS RESULT,
MEMBER FUNCTION object_exists(p_id NUMBER) RETURN BOOLEAN,
MEMBER PROCEDURE load_object(p_id NUMBER),
MEMBER PROCEDURE save_object,
MEMBER PROCEDURE insert_object,
MEMBER PROCEDURE update_object,
MEMBER PROCEDURE delete_object
MEMBER PROCEDURE load_object(p_id NUMBER) IS
BEGIN
SELECT p.id, p.vorname, p.nachname, p.geburtstag
INTO SELF.ID, SELF.vorname, self.nachname, SELF.geburtstag
FROM person p
WHERE p.id = p_id;
END;
My problem is, that if i use the member function "load_object" from my java app it doesnt return the selected values to the java class and i dont know why. I use the java class like this:
PersonObjectType p = new PersonObjectType();
p.load_object(4);
There is a reocrd in the database with id = 4 and the function will execute successful. But if i try to use "p.getVorname()" i always get "NULL". Can someone tell me how to do that?
Thanks a lot.
Edited by: NTbc on 13.07.2010 15:36
Edited by: NTbc on 13.07.2010 15:36CallableStatement =
"DECLARE
a person_type;
BEGIN
a.load_object(4);
? := a;
END;"
And register as an out parameter.
Edited by: michael76 on 14.07.2010 05:01 -
PHP- Oracle not working- Call to undefined function OCILogon() ERROR
Hi,
I am trying to just do a test program to test php - oracle connection,
My versions are: php5.2.1-Win32 and Oracle 10g
I have made the following settings:
1.) Uncommented the following lines in php.ini:
extension=php_oci8.dll
extension=php_oracle.dll
2.) Set extension_dir = "C:\php-5.2.1-Win32\ext"
Changed the httpd.conf file as: ADDED
1.)LoadModule php5_module C:/php-5.2.1-Win32/php5apache2.dll
2.)PHPIniDir "C:/Program Files/Apache Group/Apache2/conf-"
3.) LoadFile "C:/php/php5ts.dll"
4.)<IfModule php5_module>
<Location />
AddType text/html .php .phps
AddHandler application/x-httpd-php .php
AddHandler application/x-httpd-php-source .phps
</Location>
</IfModule>
5.) AddType application/x-httpd-php .php
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php-source .phps
But when I am tryin to run the following program:
<?php
echo "<h1>OCI Test</h1>\n";
$conn=OCILogon("system", "sheetal16", "orcl");
$stmt = OCIParse($conn, "SELECT table_name FROM user_tables ORDER BY table_name");
OCIExecute($stmt, OCI_DEFAULT);
while (OCIFetch($stmt)) {
$table_name = OCIResult($stmt, "TABLE_NAME");
echo "$table_name<br />\n";
OCIFreeStatement($stmt);
OCILogoff($conn);
?>
I am getting the following error:
OCI Test
Fatal error: Call to undefined function OCILogon() in C:\Program Files\Apache Group\Apache2\htdocs\test2.php on line 3
Please help me to solve this problem.
Thanks,
SheetalSee Re: PHP- Oracle not working- Call to undefined function OCILogon() ERROR
-
Performance of mapping Oracle objects to Java classes
Hi,
By retrieving some test data from Oracle database in a Java application, I compared the traditional JDBC/RDBMS solution to JPublisher-generated-classes/Oracle-object-tables solution. The underlaying Oracle database and the client environment was the same in both tests. Although the table schemas were different, they represented the same data.
It seems that the traditional JDBC/RDBMS solution is much faster. Is this a reality or did I make a mistake somewhere?
BR,
TimoI am also facing performance overhead when using Jpub generated
classes for the object types.
I am using 817 jdbc and jpub but my database is 816. I have seen
that following statements each take around 2-3 seconds to
execute. Is there any communication between driver and database
to resolve the object type ?
Please help.
cCallableStatement =
(OracleCallableStatement)m_cConnection.prepareCall("{call
list_unsync_appts_array(?,?,?,?,?,?,?,?)}");
((OracleCallableStatement)cCallableStatement).setCustomDatum(1,ct_number_arr);
cCallableStatement.registerOutParameter(2,OracleTypes.ARRAY,"T_EVENT_SUMMARY_ARR");
cCallableStatement.registerOutParameter(3,OracleTypes.ARRAY,"T_EVENT_DETAIL_ARR");
cCallableStatement.registerOutParameter(4,OracleTypes.ARRAY,"T_EVENT_SUMMARY_ARR");
cCallableStatement.registerOutParameter(5,OracleTypes.ARRAY,"T_EVENT_DETAIL_ARR");
cCallableStatement.registerOutParameter(6,OracleTypes.ARRAY,"T_EVENT_SUMMARY_ARR");
cCallableStatement.registerOutParameter(7,OracleTypes.ARRAY,"T_ATTENDEE_EMAIL_ARR");
cCallableStatement.registerOutParameter(8,OracleTypes.ARRAY,"T_ATTENDEE_EMAIL_ARR");
cCallableStatement.execute(); -
How to use Oracle objects in java code
Hi all!
I'm reading an xls and i need to fill me oracle objects with java code:
OBJECT_NAME OBJECT_TYPE
LETTURA_OBJ TYPE
LETTURA_OBJ TYPE BODY
In the past weeks i've been using both java code into oracle and oracle objects, but new i need to write those objects with data i read with java, anybody can help me?
I know that the easiest work around would be to put the data i read from the excel file into a table and then fill the oracle objects, but now i want to learn how to write directly those objects with a command like the following one:
a sample of the code i'm tryng to write:
CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED REPORT."Manage_Excel_ASMBS" AS
import java.io.*;
import java.io.IOException;
import jxl.*;
public cass ....
#sql{ variabili_globali.var_ER_F3.Tipo_Lettura := 5}
thanks,
Massimo
Edited by: LinoPisto on 16-mag-2011 16.38mmmh i'm not understanding so much....
well... as i told before i'm working in oracle database environment and i'm developing a java procedure.
now, i have this object
CREATE OR REPLACE
TYPE REPORT.FATTURA_OBJ AS OBJECT (
POD VARCHAR2(1000),
ID_FATTURA NUMBER,
ID_FILE NUMBER,
COERENZA_EA_F VARCHAR2(1000),
COERENZA_ER_F VARCHAR2(1000),
COERENZA_EA_M VARCHAR2(1000),
COERENZA_EF_M VARCHAR2(1000),
ANOMALIA VARCHAR2(1000),
MOTIVO_INVALIDAZIONE VARCHAR2(1000),
MATRICOLA_CONTATORE VARCHAR2(1000),
POTENZA_DISPONIBILE VARCHAR2(1000),
MEMBER PROCEDURE pulisci
/and i need to work with it inside this procedure:
CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED REPORT."Manage_Excel_ASMBS" AS
import java.io.*;
import java.io.IOException;
import java.io.StringWriter;
public class Manage_Excel_ASMBS
public static void read_Excel(String inputFile,int var_Id_Caricamento, int var_Id_Distributore, String var_Distributore) throws SQLException, IOException
**here i need to put what i'm reading inside the excel file into oracle objects**
/can you please give me a sample ?
thanks -
Errors in PHP/Oracle article
Hi,
There are a few errors in the article dealing with PHP/Oracle located at http://otn.oracle.com/oramag/webcolumns/2003/techarticles/hull_php.html
In the listing for the section called "How to use a database":
- $mycursor ora_open ($conn);
should be
$mycursor = ora_open ($conn);
- echo "RESULT: ora_getcolumn ($mycursor, 0), ora_getcolumn ($mycursor, 1) <br>";
The above is not the way it works in PHP and you won't get the expected results. You can throw variables in between your double-quote delimited strings, but not function calls. You'll have to concatenate the function calls like this:
echo "RESULT: ".ora_getcolumn ($mycursor, 0).", ".ora_getcolumn ($mycursor, 1)."<br>";Leendert:
Thanks for the comments. The first one is an obvious typo. The second
is a pretty obvious mistake which I missed while reviewing this. Although
PHP will expand variables in a string like that, it will not handle
function calls. How could it. I just tried it, and concatenation works
just as you suggest. Thanks for the corrections, and we updated the
article.
Sean -
Use of Complex Oracle Object with JDBC
How can I use Oracle Object(or PL/Sql type) with JDBC
I have a structure of record with some attributes and table of another attribute.
My types are defined as follows !
<code>
CREATE TYPE EMPLOYEE_GRADES AS TABLE OF VARCHAR2(50)
CREATE TYPE EMPLOYEES AS OBJECT(EmpName VARCHAR2(50), EmpGrades Employee_Grades)
</code>
My custom object might have the following structure (or should it be different)
<code>
public class EmpColl implements CustomDatum, CustomDatumFactory
-- other stuff ----
/* fields */
public String empName;
public Collection empNos;
</code>
I want to pass an variable of type EMPLOYEES to an procedure.
Thanx in Advance
Chetan
[email protected]<code>
CREATE TYPE EMPLOYEE_GRADES AS TABLE OF VARCHAR2(50)
CREATE TYPE EMPLOYEES AS OBJECT(EmpName VARCHAR2(50), EmpGrades Employee_Grades)
</code>The easiest is to use JPublisher (which comes with the SQLJ distribution).
Say:
jpub -user=username/password -sql=EMPLOYEES:Employees,EMPLOYEE_GRADES:EmployeeGrades
You will get (among others) the Java files Employees.java and EmployeeGrade.java. Go ahead, compile and use them.
Look in [Oracle Home]/sqlj/demo/jpub for a number of additional examples, and in the JPublisher User's Guide for background info.
The next (9.2) release of JPublisher will also provide some support for accessing legacy PL/SQL types from Java. -
Oracle Objects and Domains in Java Server Pages
We have defined this object in a Oracle 816 Enterprise:
CREATE TYPE DESCRIPTOR AS OBJECT
( ID VARCHAR2(30),
DESCRIPTOR VARCHAR2(80))
create TYPE descriptor_table AS VARRAY(30) of DESCRIPTOR
create table foo_test
(foo_test_id varchar2(10),
descrip descriptor_TABLE )
ALTER TABLE foo_test
ADD CONSTRAINT BIBL_test_PK PRIMARY KEY (foo_test_id)
then we have created in JDeveloper 3.1 an Entity (footest) object and a Domain (DescriptorDom) for the type DESCRIPTOR; then set the type of attribute descript to mypackage.DescriptorDom
After that, we created a JavaServer Page as follows:
<jsp:useBean class="oracle.jbo.html.databeans.JSRowSetBrowser" id="abean" scope="request" >
<% abean.setShowCurrentRow(true); abean.setVisibleRows(10); abean.setShowRecordNumbers(true); abean.setReleaseApplicationResources(false); abean.setDisplayAttributes("FooTestId,Descrip"); abean.initialize(pageContext,"ot_logics_LogicsModule.FooTestView");
abean.render();%>
</jsp:useBean>
The execution of JSP shows the error:
java.lang.ClassCastException
void oracle.jbo.domain.Struct.convertArrayToStruct()
java.lang.Object oracle.jbo.domain.Struct.getAttribute(int)
java.lang.String oracle.jbo.domain.Struct.toString()
void oracle.jbo.html.databeans.JSRowSetBrowser.internalInitialize()
void oracle.jdeveloper.html.WebBeanImpl.initialize(javax.servlet.ServletContext, javax.servlet.http.HttpSession,
javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.io.PrintWriter)
void oracle.jdeveloper.html.DataWebBeanImpl.initialize(javax.servlet.ServletContext, javax.servlet.http.HttpSession,
javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.io.PrintWriter, java.lang.String)
void oracle.jdeveloper.html.DataWebBeanImpl.initialize(javax.servlet.jsp.PageContext, java.lang.String)
void ot_pages_html.bibl_test._jspService(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse)
void oracle.jsp.runtime.HttpJsp.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
void oracle.jsp.app.JspApplication.dispatchRequest(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse)
void oracle.jsp.JspServlet.doDispatch(oracle.jsp.app.JspRequestContext)
void oracle.jsp.JspServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
void oracle.lite.web.JupServlet.service(oracle.lite.web.JupRequest, oracle.lite.web.JupResponse)
void oracle.lite.web.MimeServletHandler.handle(oracle.lite.web.JupApplication, java.lang.String, int,
oracle.lite.web.JupRequest, oracle.lite.web.JupResponse)
void oracle.lite.web.JupApplication.service(oracle.lite.web.JupRequest, oracle.lite.web.JupResponse)
void oracle.lite.web.JupAppHandler.handle(oracle.lite.web.JupRequest, oracle.lite.web.JupResponse)
void oracle.lite.web.HTTPServer.include(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
void oracle.lite.web.HTTPServer.forward(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
boolean oracle.lite.web.HTTPServer.handleRequest(oracle.lite.web.JupInputStream, java.io.OutputStream)
boolean oracle.lite.web.JupServer.handle(oracle.lite.web.JupInputStream, java.io.OutputStream)
void oracle.lite.web.JupHTTPListener$JupHTTP.run()
Please JTeam, could you illuminate me about how implement ORACLE objects in Entity object s and JavaServer Pages?
ps The code generated by JPublisher seems be more complete that done by wizard of Domains. We sould use JPublisher?. How set the attribute type?
Thank in advance.
J LuisHi,
It looks like this might be a bug. I am going to use the information you supplied to file a bug so our QA team can investigate.
We have had problems with arrays of structs, but hope to have them fixed with our next release. -
Php, oracle connectivity.
Hello All,
I have a webserver that has php4,apache1.3 and oci8 instant client installed, and have a seperate oracle 10g db server, the php-oracle connectivity is fine when i run php code from db server but it gives me connectivity error when it runs from web server, error " ocifreestatement(): supplied argument is not a valid OCI8-Statement resource in /apache/htdocs/.....php on line..." while even when i made telnet to my db server 1521 port from web server it shows that listener is working, any idea ? thanksHello,
My developers have changed all the API´s to OCI8 and the code is able to connect with oracle 10g with php4 but, i am still getting this warning .i.e
Warning: ocifreestatement(): supplied argument is not a valid OCI8-Statement resource in /apache/htdocs/English/tender_list.php on line 340
i am unable to figure it out, every thing is working fine but still i am getting it ?
thanks -
Oracle Object Types vs. Table Fields
Hello, all.
I`m totally new to Oracle, and I am facing a very hard problem for me, and I would like to ask your help.
I've been working on a project which uses Oracle Object Types, from a database of a legacy system.
I did not know Oracle Objects until 5 minutes ago, so sorry If I say something stupid:
Per my understanding, a Oracle Object Type can be formed by fields like myField varchar(200)... and fields from an existing table or view.
I have a lot of objects on my system and I need to map each field and its respective table or view that compose each object.
Does anyone have a query for that? I think it should be common, but I could not find anything at google (maybe I don`t which terms use to find...)
I would be very thankful if somebody could help (save) me.
Thanks in advance.
PauloFirst, it would help if you post what you object types look like.
I'm assuming they may look something like this:
SQL> create TYPE emp_type AS OBJECT
2 (emp_id NUMBER,
3 name VARCHAR2(20));
4 /
Type created.
SQL> create TYPE emp_tab IS TABLE OF emp_type;
2 /
Type created.
SQL> create or replace package emp_test as
2 procedure get_emps;
3 end emp_test ;
4 /
Package created.
SQL> create or replace package body emp_test as
2 employees emp_tab := emp_tab();
3 procedure get_emps as
4 g_rc sys_refcursor;
5 BEGIN
6 employees.EXTEND(2);
7 employees(1) := emp_type (1, 'John Smith');
8 employees(2) := emp_type (2, 'William Jones');
9 OPEN g_rc FOR
10 SELECT * FROM TABLE (CAST (employees AS emp_tab));
11 END get_emps ;
12 end emp_test ;
13 /
Package body created. -
Oracle Object Views Jdeveloper compatibility
Our application has been designed OOAD and documented in UML. We mapped the UML class diagrams to relational tables and created Oracle object views on top of these tables. From these views we can now generate C++ code with OTT. However, trying to access these views from JDeveloper gives us some problems. Specifically, if an object type defined by "CREATE TYPE xxx AS OBJECT" has a REF column somewhere inside it, there seems to be very little support for this in JDeveloper 10g. Our example is a country with numerous provinces. A provice type has a reference to the country type it falls in. Trying to make a GUI to maintain the provinces gives us no way to select a country to make the REF column from. In JDeveloper, when using the object view to create a maintenance GUI, we see the reference to the country in binary form. Typically we would want to select the country from a drop-down box containing country names instead of binary references. Can someone please point me to documentation describing how to do this or explain here. Thank you in advance.
Not sure if this will be helpful for you, but maybe a better approach for your Java project will be to use TopLink to map your Java objects directly to the relational schema using TopLink's meet-in-the-middle capabilities.
This way you won't need to work with the Object views in the database.
More on TopLink here:
http://www.oracle.com/technology/products/ias/toplink/index.html
Some demos of the mapping capabilities are here:
http://www.oracle.com/technology/products/ias/toplink/mwdemos/index.html
TopLink is very well integrated with JDeveloper 10.1.2 -
Oracle object cols and inserts
hi,
i have a type defined as follows
create type foo
a number(10),
b number(10),
c date, d date);
now i use this in a table as follows
create table test
foo_obj foo default foo(-1, -1, sysdate, sysdate) not null,
foo_name varchar2(100) not null
now what im really interested in is when i do
an insert id like to specify only some of
the values for a given obj
aka
insert into test(foo_obj, foo_name)
values (foo_obj.a(10), 'test')
so the rest of the values for that obj
come from the defaults specified..
ive been unable to find examples for the above method in the 8i docs & any help here
on the correct syntax with an example would
help enormously
thanx
pete
nullOracle® Database Object-Relational Developer's Guide
Also note that object relational database design is often less performant and scalable than relational. It is not very often used in production environments.
However, the object orientated programming feature that is provided with Oracle object feature set are used and can make development and interfaces a lot easier.
So in a nutshell. Say no to ref and nested table columns. Say yes to most of the other object features. IMO of course... -
I have an application that I would like to map bc4j to a object type hierarchy in the database. From reading previous otn threads I'm under the impression that Domains are not used for Oracle Table Types, just for columns based on oracle types. The thread later goes on to say that for the base type (person_typ) I would map a entity object to the table(person_table) mapped to the base type. To map all the sub-types I would create new entity objects and have PersonEO subclassed into StudentEO and EmployeeEO.
I have done this and it's unclear to me when I subclass PersonEO as StudentEO how do I declare that StudentEO is of oracle object type student_typ?
I'm also having problems with inserting data into the base entity obect. Here's code:
PersonVOImpl personVo = am.getPersonVO();
PersonVORowImpl row = (PersonVORowImpl)personVo.createRow();
personVo.insertRow(row);
row.setName("Mark");
row.setPhone("911");
am.getTransaction().commit();
personVo.executeQuery();
while (personVo.hasNext()){
PersonVORowImpl personRow = (PersonVORowImpl)personVo.next();
The data gets comitted to the db correctly but when the code hits personVo.executeQuery() I get the following error:
oracle.jbo.domain.DataCreationException: JBO-25009: Cannot create an object of type:oracle.sql.STRUCT with value:Mark
at oracle.jbo.domain.TypeFactory.get(TypeFactory.java:687)
at oracle.jbo.domain.TypeFactory.getInstance(TypeFactory.java:80)
at oracle.jbo.server.OracleSQLBuilderImpl.doLoadBulkFromResultSet(OracleSQLBuilderImpl.java:1113)
at oracle.jbo.server.ViewRowImpl.populate(ViewRowImpl.java:2017)
at oracle.jbo.server.ViewDefImpl.createInstanceFromResultSet(ViewDefImpl.java:1013)
at oracle.jbo.server.ViewObjectImpl.createRowFromResultSet(ViewObjectImpl.java:2309)
at oracle.jbo.server.ViewObjectImpl.createInstanceFromResultSet(ViewObjectImpl.java:2240)
at oracle.jbo.server.QueryCollection.populateRow(QueryCollection.java:1698)
at oracle.jbo.server.QueryCollection.fetch(QueryCollection.java:1552)
at oracle.jbo.server.QueryCollection.get(QueryCollection.java:1008)
at oracle.jbo.server.ViewRowSetImpl.getRow(ViewRowSetImpl.java:2791)
at oracle.jbo.server.ViewRowSetIteratorImpl.doFetch(ViewRowSetIteratorImpl.java:2504)
at oracle.jbo.server.ViewRowSetIteratorImpl.ensureRefreshed(ViewRowSetIteratorImpl.java:2368)
at oracle.jbo.server.ViewRowSetIteratorImpl.refresh(ViewRowSetIteratorImpl.java:2569)
at oracle.jbo.server.ViewRowSetImpl.notifyRefresh(ViewRowSetImpl.java:1641)
at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:577)
at oracle.jbo.server.ViewRowSetImpl.executeQueryForMasters(ViewRowSetImpl.java:611)
at oracle.jbo.server.ViewRowSetImpl.executeQuery(ViewRowSetImpl.java:593)
at oracle.jbo.server.ViewObjectImpl.executeQuery(ViewObjectImpl.java:2886)
at model.testing.main(testing.java:33)
Am I coding this correctly? I'm using jdev9032 for this. Are there any examples out there on how to correctly use bc4j with oracle object type tables?
Thanks in advance!
-MarkHere is my ddl:
CREATE TYPE Person_typ AS OBJECT
( name VARCHAR2(30),
address VARCHAR2(100)) NOT FINAL
CREATE TABLE PERSON_TABLE OF PERSON_TYP
I map a entity object to person_table one for one and I edit the SYS_NC_OID$ property of updateable to never.
I then map a view object one for one to the entity object. The jbo trace I get when -Djbo.debugoutput=console is declared is the following (omitted everything before the db connected).[156] Successfully logged in
[157] JDBCDriverVersion: 9.0.1.4.0
[158] DatabaseProductName: Oracle
[159] DatabaseProductVersion: Personal Oracle9i Release 9.2.0.1.0 - Production With the Partitioning, OLAP and Oracle Data Mining options JServer Release 9.2.0.1.0 - Production
[160] ViewRowSetImpl's jbo.viewlink.consistent = false (0)
[161] Column count: 3
[162] Executing SQL in generateRefAndOID...
[163] select a.oid, make_ref(PERSON_TABLE, a.oid) from (select /*+ NO_MERGE +*/ sys_op_guid() as oid from dual) a
[164] OracleSQLBuilder Executing DML on: PERSON_TABLE (Insert)
[165] INSERT INTO PERSON_TABLE(NAME,ADDRESS) VALUES (:1,:2)
[166] BaseSQLBuilder: releaseSavepoint 'BO_SP' ignored
[167] PersonVO notify COMMIT ...
[168] Column count: 3
[169] ViewObject : Created new QUERY statement
[170] SELECT REF(PersonTable), PersonTable.NAME, PersonTable.ADDRESS FROM PERSON_TABLE PersonTable
[171] LoadBulkFromResultSet failed (2)
oracle.jbo.domain.DataCreationException: JBO-25009: Cannot create an object of type:oracle.sql.STRUCT with value:Mark
java.lang.Object oracle.jbo.domain.TypeFactory.get(java.lang.Class, java.lang.Class, java.lang.Object)
TypeFactory.java:687
java.lang.Object oracle.jbo.domain.TypeFactory.getInstance(java.lang.Class, java.lang.Object)
TypeFactory.java:80
java.lang.Object[] oracle.jbo.server.OracleSQLBuilderImpl.doLoadBulkFromResultSet(oracle.jbo.server.AttributeDefImpl[], int, java.sql.ResultSet, int, oracle.jbo.server.DBTransactionImpl)
OracleSQLBuilderImpl.java:1059
void oracle.jbo.server.ViewRowImpl.populate(java.sql.ResultSet)
ViewRowImpl.java:1964
oracle.jbo.server.ViewRowImpl oracle.jbo.server.ViewDefImpl.createInstanceFromResultSet(oracle.jbo.server.ViewObjectImpl, oracle.jbo.server.QueryCollection, java.sql.ResultSet)
ViewDefImpl.java:1019
oracle.jbo.server.ViewRowImpl oracle.jbo.server.ViewObjectImpl.createRowFromResultSet(java.lang.Object, java.sql.ResultSet)
ViewObjectImpl.java:2035
oracle.jbo.server.ViewRowImpl oracle.jbo.server.ViewObjectImpl.createInstanceFromResultSet(oracle.jbo.server.QueryCollection, java.sql.ResultSet)
ViewObjectImpl.java:1966
oracle.jbo.server.ViewRowImpl oracle.jbo.server.QueryCollection.populateRow()
QueryCollection.java:1395
boolean oracle.jbo.server.QueryCollection.fetch(int)
QueryCollection.java:1237
java.lang.Object oracle.jbo.server.QueryCollection.get(int)
QueryCollection.java:832
oracle.jbo.Row oracle.jbo.server.ViewRowSetImpl.getRow(int)
ViewRowSetImpl.java:2621
void oracle.jbo.server.ViewRowSetIteratorImpl.doFetch(int)
ViewRowSetIteratorImpl.java:2347
void oracle.jbo.server.ViewRowSetIteratorImpl.ensureRefreshed()
ViewRowSetIteratorImpl.java:2211
void oracle.jbo.server.ViewRowSetIteratorImpl.refresh(boolean, boolean)
ViewRowSetIteratorImpl.java:2412
void oracle.jbo.server.ViewRowSetImpl.notifyRefresh(boolean, boolean)
ViewRowSetImpl.java:1556
void oracle.jbo.server.ViewRowSetImpl.execute(boolean, boolean)
ViewRowSetImpl.java:548
void oracle.jbo.server.ViewRowSetImpl.executeQuery()
ViewRowSetImpl.java:564
void oracle.jbo.server.ViewObjectImpl.executeQuery()
ViewObjectImpl.java:2616
void mypackage1.testing.main(java.lang.String[])
testing.java:25
Exception in thread main
Process exited with exit code 1.
Please let me know if you need more information.
-Mark -
Oracle object, nested table on a subtype
Hello,
Is it possible to have a nested table on a subtype? If it is, can someone help me?
Here is what I need help for:
I have a supertype WORK, that have:
multivalued attribute ADDRESS
a attribute NAME, also the primary key
The subtype is called EMPLOYEE, that have:
multivalued attribute SPECIALTY
a attribute NAME
a attribute SSN
So far have I got:
//* The supertype *//
create or replace type ADRESS_TP as object(
ADRESS varchar2(50));
create or replace type ADRESSTP as table of ADRESS_TP;
create or replace WORK_TP as object(
NAME varchar2(30),
ADRESS ADRESSTP)
NOT FINAL;
create table WORK_TBL of WORK_TP(
Primary key(NAME))
nested table ADRESS store as NT_ADR(
(Primary key(nested_table_id, ADRESS))
organization index compress);
//* The subtype *//
create or replace type SPECIALTY_TP as object(
ADRESS varchar2(50));
create or replace type SPECIALTYTP as table of SPECIALTY_TP;
create or replace EMPLOYEE_TP under work_tp(
NAME varchar2(30),
SSN number)
FINAL;
The multivalued attribute SPECIALTYTP has to be declared in WORK_TBL have I been told, but how can I do that?
I'm using oracle 9iI'm not really sure what your problem is. In future please be specific about what it is you are trying to do and what it is that is not working. If it's an error please give us the error message and number. It's not the behaviour you are expecting please describe what it does. If it's that you simply don't understand please say what you don't understand.
I go on like this because the code you have posted is somewhat confusing. The Oracle object-oriented implementation is not quite complete so that makes it hard for people who know OO but don't know Oracle. Whereas most of us who know Oracle aren't expert in OO. Also, I think you should be slightly more inventive in your names: there's so many things called ADRESS it's easy to get them tangled up.
Anyway, here's my guess at what I think your problem is....
SQL> CREATE OR REPLACE TYPE adress_t AS OBJECT(
2 line1 VARCHAR2(50)
3 ,line2 VARCHAR2(50)
4 ,postcode VARCHAR2(8));
5 /
Type created.
SQL>
SQL> CREATE OR REPLACE TYPE adress_nt AS TABLE OF adress_t;
2 /
Type created.
SQL> CREATE OR REPLACE TYPE work_t AS OBJECT(
2 name VARCHAR2(30),
3 adresses adress_nt)
4 NOT FINAL;
5 /
Type created.
SQL> CREATE TABLE work_tbl OF work_t
2 NESTED TABLE adresses STORE AS adress_ntab
3 /
Table created.
SQL> CREATE OR REPLACE TYPE specialty_t AS OBJECT(
2 description VARCHAR2(50));
3 /
Type created.
SQL> CREATE OR REPLACE TYPE specialty_nt AS TABLE OF specialty_t;
2 /
Type created.
SQL>
SQL> ALTER TYPE work_t ADD ATTRIBUTE specialities specialty_nt CASCADE
2 /
Type altered.
SQL> DESC work_tbl
Name Null? Type
NAME VARCHAR2(30)
ADRESSES ADRESS_NT
SPECIALITIES SPECIALTY_NT
SQL> Cheers, APC -
Help on accessing Oracle object !
Hi,
Looking for a help in accessing oracle object using JDBC. I've the following object defined in Oracle.
TYPE ty_ctg_prod AS OBJECT(
PROD VARCHAR2(40 ),
NODE_ID NUMBER ,
CTG_ID NUMBER );
TYPE ctg_PROD_ary AS VARRAY (50) OF ty_ctg_PROD;
The procedure out parameter is returning :
x_ctg_prod_ary OUT ctg_prod_ary
Do I need to use a OracleTypes.STRUCT API Or oracle.sql.ARRAY to access data in this scenario.
Any pointers will be highly appreciated.
Thanks,
Shamik// Get the object1 value from the second column col_object1
oracle.sql.STRUCT object1 = (oracle.sql.STRUCT)collabstatement.getObject(2);
// Get the object1 values from each row
Object[] object1Values = object1.getAttributes();
// Get the first value of object1, which is a string
String str = (String)object1Values[0];
// Get the second value of object1, which is of the type object2
oracle.sql.STRUCT object2 = (oracle.sql.STRUCT)object1Values[1];
// Get the values of object2
Object object2Values[] = object2.getAttributes();
str = (String)object2Values[0];
BigDecimal num = (BigDecimal)object2Values[1];you can also use :oracle.sql.Datum[] attrs = oracleSTRUCT.getOracleAttributes();more info :
http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jdbc/objects/ObjectTypes.html
Maybe you are looking for
-
How do I stop Firefox unloading background tabs?
Hi there, Can anyone tell me how to stop firefox for android unloading tabs it thinks are in the background and not being used? Here's the situation - I had about 5 tabs open in firefox on my Galaxy Note (around 1GB memory) and no other applications
-
How do you " properly " reply to Apple support once they've contacted you?
This sounds very minuscule ( I KNOW) , but I am pretty sure I am doing this correctly. I am having some issues with my iTunes and need tech support. I've emailed them and got a response from tech very swiftly, asking for specific information and scre
-
Mail app crashes (SIGSEGV) KERN_INVALID_ADDRESS at 0xffffffff89abce37
Hello, On this particular machine, mail keeps crashing for some reason (SIGSEGV). I don't know exactly what's the cause of the crash so i can try to repair it. Can you guys take a quick look at the crash report? PS: I also submitted another thre
-
El Exception - attemp to coerce a value
I need to perform some arithmatic operation on the value which is from a vo. I tried the below code for it. "#{(bindings.XxWorkExpDetailsVO1ExperienceMonths mod '2')}" But am getting the exception javax.faces.el.EvaluationException: com.sun.faces.el.
-
Hi, I have installed 9i AS 1.0.2.1 on NT and pdkmay.zip I am trying to use the imap portlet to check mail.I add the portlet I am able to see it. When I customize the portlet information and add information like server info, mailuser name etc. I am no