How to index a varray of object type?
Hello,
Is it possible to index a varray/Table type, which is of type of an object, like the way the scalar types are.
say, CREATE OR REPLACE
TYPE SAMPLE_TABLE AS TABLE OF Date index by binary_integer
But if I have to change the table type from Date to an object
lets say
create or replace TYPE SAMPLE_TYPE AS OBJECT (
id NUMBER(12),
value varchar2(12)
Will I be able to do
CREATE OR REPLACE
TYPE SAMPLE_TABLE AS TABLE OF SAMPLE_TYPE index by id
If not, is there a way it can be done, or is it a limitaion that it cant be done. Any pointers to this is highly appreciated.
Thanks
One way to do this...
SQL> drop type profile_options_object_array
2 /
SQL> drop type profile_options_object
2 /
SQL> drop table t
2 /
SQL>
SQL> CREATE OR REPLACE TYPE profile_options_object AS OBJECT(
2 option_name VARCHAR2(100),
3 option_value VARCHAR(200)
4 );
5 /
SQL> CREATE OR REPLACE TYPE profile_options_object_array AS VARRAY(32000) OF profile_options_object;
2 /
SQL>
SQL> create table t
2 (x varchar2(10)
3 ,y varchar2(10)
4 );
SQL> insert into t values ('name1', 'value1');
SQL> insert into t values ('name2', 'value2');
SQL> commit;
SQL>
SQL> select profile_options_object (x, y)
2 from t
3 /
PROFILE_OPTIONS_OBJECT(X,Y)(OPTION_NAME, OPTION_VALUE)
PROFILE_OPTIONS_OBJECT('name1', 'value1')
PROFILE_OPTIONS_OBJECT('name2', 'value2')
SQL> declare
2 profile_options profile_options_object_array;
3 idx pls_integer;
4 begin
5 select profile_options_object (x, y)
6 bulk collect
7 into profile_options
8 from t
9 ;
10 idx := profile_options.first;
11 while idx is not null
12 loop
13 dbms_output.put_line (profile_options(idx).option_name);
14 dbms_output.put_line (profile_options(idx).option_value);
15 idx := profile_options.next(idx);
16 end loop;
17 end;
18 /
name1
value1
name2
value2
SQL>
Similar Messages
-
Problem in fetching varray of Object type
Below are the code,
where am calling an procedure which returns me Varray of object type test_obj(id number, name varchar2);
Am facing an problem in get the object(test_obj) from ARRAY object
the exception is java.lang.ClassCastException: java.lang.Object
at line number No 12..
Can anyone suggest me How handle this...
1. STRUCT test_objStruct ;
2. ARRAY test_arr;
3. OracleCallableStatement cs = (OracleCallableStatement)
4. con.prepareCall("{call test_data(?)}");
5. cs.registerOutParameter(1,oracle.jdbc.driver.OracleTypes.ARRAY,"TEST_ARR");
6. cs.execute();
7. test_arr = (ARRAY)cs.getObject(1);
8.System.out.println("array varible "+test_arr.getBaseTypeName());
9. System.out.println("length "+test_arr.length());
10. Map map = (Map)con.getTypeMap();
11. map.put("TEST_OBJ", Class.forName("oracle.sql.STRUCT"));
12. test_objStruct = (STRUCT)test_arr.getArray(1,1);
13.Object country_attrs[] = test_objStruct.getAttributes();
14.System.out.println ("ID: " country_attrs[0]);
15.System.out.println ("Name: " +country_attrs[1]);
the output is..
array varible TEST_OBJ
length 106
Error java.lang.ClassCastException: java.lang.ObjectHi,
The error occurs on line 12, the first time through the loop, when you try to execute:
vClient(iCounter).ename_obj:=i.ename;
At that point, vClient (1) is not an Employee object; it's NULL.
Try this:
DECLARE
TYPE tvrEmploy IS VARRAY(10) OF Employee;
vClient tvrEmploy;
iCounter integer := 1;
CURSOR client_cursor IS
SELECT ename, sal
, empno -- ADDED
FROM scott.emp
WHERE rownum < 11;
BEGIN
vClient := tvrEmploy (null,null,null,null,null,null,null,null,null,null) ;
FOR i IN client_cursor LOOP
vClient (iCounter) := Employee (i.ename, i.empno, i.sal); -- CHANGED
iCounter := iCounter + 1;
END LOOP;
FOR I IN REVERSE 1..10 LOOP
dbms_output.put_line(to_char(I) ||' '|| vClient(I).ename_obj ||' '|| vClient(I).empno_obj ||' '||
vClient(I).sal_obj);
END LOOP;
END ; -
Dynamically built query on execution How to save the data in Object Type
Hi,
In pl/sql I am building and executing a query dynamically. How can I stored the output of the query in object type. I have defined the following object type and need to store the
output of the query in it. Here is the Object Type I have
CREATE OR REPLACE TYPE DEMO.FIRST_RECORDTYPE AS OBJECT(
pkid NUMBER,
pkname VARCHAR2(100);
pkcity VARCHAR2(100);
pkcounty VARCHAR2(100)
CREATE OR REPLACE TYPE DEMO.FIRST_RECORDTYPETAB AS TABLE OF FIRST_RECORDTYPE;Here is the query generated at runtime and is inside a LOOP
--I initialize my Object Type*
data := new FIRST_RECORDTYPETAB();
FOR some_cursor IN c_get_ids (username)
LOOP
x_context_count := x_context_count + 1;
-- here I build the query dynamically and the same query generated is
sql_query := 'SELECT pkid as pid ,pkname as pname,pkcity as pcity, pkcounty as pcounty FROM cities WHERE passed = <this value changes on every iteration of the cursor>'
-- and now I need to execute the above query but need to store the output
EXECUTE IMMEDIATE sql_query
INTO *<I need to save the out put in the Type I defined>*
END LOOP;
How can I save the output of the dynamically built query in the Object Type. As I am looping so the type can have several records.
Any help is appreciated.
Thankshai ,
solution for Dynamically built query on execution How to save the data in Object Type.
Step 1:(Object creation)
SQL> ED
Wrote file afiedt.buf
1 Create Or Replace Type contract_details As Object(
2 contract_number Varchar2(15),
3 contrcat_branch Varchar2(15)
4* );
SQL> /
Type created.
Step 2:(table creation with object)
SQL> Create Table contract_dtls(Id Number,contract contract_details)
2 /
Table created.
Step 3:(execution Of procedure to insert the dynamic ouput into object types):
Declare
LV_V_SQL_QUERY Varchar2(4000);
LV_N_CURSOR Integer;
LV_N_EXECUTE_CURSOR Integer;
LV_V_CONTRACT_BR Varchar2(15) := 'TNW'; -- change the branch name by making this as input parameter for a procedure or function
OV_V_CONTRACT_NUMBER Varchar2(15);
LV_V_CONTRACT_BRANCH Varchar2(15);
Begin
LV_V_SQL_QUERY := 'SELECT CONTRACT_NUMBER,CONTRACT_BRANCH FROM CC_CONTRACT_MASTER WHERE CONTRACT_BRANCH = '''||LV_V_CONTRACT_BR||'''';
LV_N_CURSOR := Dbms_Sql.open_Cursor;
Dbms_Sql.parse(LV_N_CURSOR,LV_V_SQL_QUERY,2);
Dbms_Sql.define_Column(LV_N_CURSOR,1,OV_V_CONTRACT_NUMBER,15);
Dbms_Sql.define_Column(LV_N_CURSOR,2,LV_V_CONTRACT_BRANCH,15);
LV_N_EXECUTE_CURSOR := Dbms_Sql.Execute(LV_N_CURSOR);
Loop
Exit When Dbms_Sql.fetch_Rows (LV_N_CURSOR)= 0;
Dbms_Sql.column_Value(LV_N_CURSOR,1,OV_V_CONTRACT_NUMBER);
Dbms_Sql.column_Value(LV_N_CURSOR,2,LV_V_CONTRACT_BRANCH);
Dbms_Output.put_Line('CONTRACT_BRANCH--'||LV_V_CONTRACT_BRANCH);
Dbms_Output.put_Line('CONTRACT_NUMBER--'||OV_V_CONTRACT_NUMBER);
INSERT INTO contract_dtls VALUES(1,CONTRACT_DETAILS(OV_V_CONTRACT_NUMBER,LV_V_CONTRACT_BRANCH));
End Loop;
Dbms_Sql.close_Cursor (LV_N_CURSOR);
COMMIT;
Exception
When Others Then
Dbms_Output.put_Line('SQLERRM--'||Sqlerrm);
Dbms_Output.put_Line('SQLERRM--'||Sqlcode);
End;
step 4:check the values are inseted in the object included table
SELECT * FROM contract_dtls;
Regards
C.karukkuvel -
How to built cyclic stream of object type: BufferedOutputStream?
Need to know if there is a pointer that can be set, so will be able to override the stream from a certain byte. What procedures to use?
Thanks,
Sarit.Multiposthttp://forum.java.sun.com/thread.jspa?threadID=627863
-
Hello,
I am still very new at PL/SQL so please bare with me if you can. I am trying to learn how to store data from an object in a single varray of objects. My code below is attempting to declare an object type with 3 instance attributes and 3 instance methods of getter and setter method.
Then i want to create a varray type to store an array of "Employee" object types.
From here i am trying to use a loop to retrieve the first 10 ename, empno, and sal records from the emp table and store them in the variable array of 10 elements.
Finally, I tried to use another loop to output the ename, empno, and sal in reverse order.
My object and my object body was created successfully with no errors.
The problem starts when I begin the anonymous block that creates the varray, this is where i get an error message at the end.
At the end of my code is the error message i get. Can anyone suggest to me what I am doing wrong, and/or what I can do to achieve this task.
SET SERVEROUTPUT ON
--create object
CREATE OR REPLACE TYPE Employee AS OBJECT(
ename_obj VARCHAR2(10),
empno_obj NUMBER(4),
sal_obj NUMBER(7,2),
MEMBER FUNCTION getename RETURN VARCHAR2,
MEMBER FUNCTION getempno RETURN NUMBER,
MEMBER FUNCTION getsal RETURN NUMBER);
--create object body
CREATE OR REPLACE TYPE BODY Employee AS
MEMBER FUNCTION getename RETURN VARCHAR2 IS
BEGIN
RETURN ename_obj;
END;
MEMBER FUNCTION getempno RETURN VARCHAR2 IS
BEGIN
RETURN empno_obj;
END;
MEMBER FUNCTION getsal RETURN VARCHAR2 IS
BEGIN
RETURN sal_obj;
END;
END;
--create varray of object and begin line 1 of ERROR Message--
1> DECLARE
2> TYPE tvrEmploy IS VARRAY(10) OF Employee;
3> vClient tvrEmploy;
4> iCounter integer:=1;
5> CURSOR client_cursor IS
6> SELECT ename, sal
7> FROM emp
8> WHERE rownum < 11;
9> BEGIN
10> vClient:=tvrEmploy(null,null,null,null,null,null,null,null,null,null) ;
11> FOR i IN client_cursor LOOP
12> vClient(iCounter).ename_obj:=i.ename;
13> vClient(iCounter).empno_obj:=i.empno;
14> vClient(iCounter).sal_obj:=i.sal;
15> iCounter:=iCounter+1;
16> END LOOP;
17> FOR I IN REVERSE 1..10 LOOP
18> dbms_output.put_line(to_char(I) ||' '|| vClient(I).ename_obj ||' '|| vClient(I).empno_obj ||' '||
vClient(I).sal_obj);
19> END LOOP;
20> END ;
21> /
--ERROR message below--
DECLARE
ERROR at line 1:
ORA-06530: Reference to uninitialized composite
ORA-06512: at line 12
Thank you again for your time and patience.
-ToddHi,
The error occurs on line 12, the first time through the loop, when you try to execute:
vClient(iCounter).ename_obj:=i.ename;
At that point, vClient (1) is not an Employee object; it's NULL.
Try this:
DECLARE
TYPE tvrEmploy IS VARRAY(10) OF Employee;
vClient tvrEmploy;
iCounter integer := 1;
CURSOR client_cursor IS
SELECT ename, sal
, empno -- ADDED
FROM scott.emp
WHERE rownum < 11;
BEGIN
vClient := tvrEmploy (null,null,null,null,null,null,null,null,null,null) ;
FOR i IN client_cursor LOOP
vClient (iCounter) := Employee (i.ename, i.empno, i.sal); -- CHANGED
iCounter := iCounter + 1;
END LOOP;
FOR I IN REVERSE 1..10 LOOP
dbms_output.put_line(to_char(I) ||' '|| vClient(I).ename_obj ||' '|| vClient(I).empno_obj ||' '||
vClient(I).sal_obj);
END LOOP;
END ; -
Cannot query varray of object types-please help
I am attempting to query the "diminfo" field of the view "MDSYS.all_sdo_geom_metadata". The field is "described" as MDSYS.SDO_DIM_ARRAY, which I believe is a varray of MDSYS.SDO_DIM_ELEMENT.
I have run OTT to generate the class files, but nothing is generated for the MDSYS.SDO_DIM_ARRAY "type" (maybe because it's not really a type?). A class is generated for the SDO_DIM_ELEMENT objects.
Anyway, I have tried to query the field using both "VALUE(diminfo)" and "REF(diminfo)":
select VALUE(diminfo) from all_sdo_geom_metadata;
- or -
select REF(diminfo) from all_sdo_geom_metadata;
and I get back an ORA-904 "invalid identifier". When I remove the "VALUE" or "REF" from the query, the error goes away, and is replaced by an ORA-32162 "Read/Write method not registered" further down in the code when I try to retreive the value from the recordset:
myDimInfo = rSet->getObject(1);
Since the field type (MDSYS.SDO_DIM_ARRAY) isn't really an object type, I can see why the "Read/Write method not registered" occurs-there are no methods to register.
Can someone provide a code snippet of how to perform this query?
Thanks in advanceHi,
I am using OTT generated objects to pass them to my PL/SQL procedures as OUT parameters. When I call the registerOutParam() function, I get this error ORA-32162: Read/Write SQL method not registered.
I am calling my mapping function after creating environment and before creating my stateless connection pool. But still I am getting this exception at runtime while calling registerOutParam().
Environment* env;
env = Environment::createEnvironment(Environment::OBJECT);
MessageTOMapping(env); // Calling the mapping function here.
// Creating the stateless connection pool.
StatelessConnectionPool* scp;
scp = env->createStatelessConnectionPool("naveen",
"naveen",
"//10.105.153.11:1521/pls",
10,
5,
2,
StatelessConnectionPool::HOMOGENEOUS);
// Fetch a connection from the stateless connection pool
conn = scp->getConnection();
// After this, I create my Statement and call the registerOutParam() which
// causes ORA-32162 exception.
Please note that I do not get this error when I don't use any connection-pooling mechanism. That is, if I create an environment in OBJECT mode, call the mapping function with its pointer and create a normal Connection object (without any pooling etc), my application runs perfectly fine. E.g. if I replace the above piece of code with the code below, my application runs fine.
Environment* env;
env = Environment::createEnvironment(Environment::OBJECT);
MessageTOMapping(env); // Calling the mapping function here.
conn = env->createConnection("naveen", "naveen", "//10.105.153.11:1521/pls");
// After this, I create my Statement and call the registerOutParam() which
// does not give problem now and my application runs pefectly fine.
Can anyone let me know what I am doing wrong while using the stateless connection pooling mechanism? I definitely need to use Stateless Connection Pooling and must not get connections directly from env->createConnection().
Any help will be greatly appreciated.
Thanks and Regards,
Naveen -
How i will retrive rows from object type
test is object type(varchar2,varchar2)
test1 is a object derived from test
test1(varchar2,varchar2,test);
how i will retrive rows from test1.
declare
type recf is ref cursor;
v_tab test1 := test1('a','b',test('c','d'));
rec recf;
begin
open rec for
select * from table(cast(v_tab as test1));
dbms_output.put_line('the rows are'||rec.test1.test11);
end;
when i compile this it return
ERROR at line 7:
ORA-06550: line 7, column 35:
PL/SQL: ORA-22907: invalid CAST to a type that is not a nested table or VARRAY
ORA-06550: line 7, column 1:
PL/SQL: SQL Statement ignored
ORA-06550: line 8, column 48:
PLS-00487: Invalid reference to variable 'REC'
ORA-06550: line 8, column 1:
PL/SQL: Statement ignored
error.hi ur previous example really helping me but please help me in this current senario,
PROCEDURE reserveNumbers (
TheNumberRange IN NumberRange,
UserID IN userid,
ReturnStatus OUT CallStatus ); which is in P_Numbermgr_Api package.
here NumberRange is a object
TYPE NumberRange IS OBJECT (
StartNumber VARCHAR2(40),
EndNumber VARCHAR2(40),
NumberAttributes NumberAttr)
NumberAttributes field based on NumberAttr object
TYPE NumberAttr IS OBJECT (
NumberType VARCHAR2(15),
CountryCode VARCHAR2(10),
CityCode VARCHAR2(3))
i write a package within package i am calling P_Numbermgr_Api.reserveNumbers:
CREATE or replace TYPE My_numberrange IS TABLE OF numberrange;
CREATE OR REPLACE PACKAGE numberrange_wrapper AS
TYPE cursor_type IS REF CURSOR;
TYPE cursor_type1 IS REF CURSOR;
TYPE cursor_type2 IS REF CURSOR;
v_userid number;
PROCEDURE Getnumberrange (userid IN number,
p_recordset OUT numberrange_wrapper.cursor_type);
END numberrange_wrapper;
within package body i write
CREATE OR REPLACE PACKAGE body numberrange_wrapper AS
PROCEDURE Getnumberrange (userid IN number,p_recordset IN OUT numberrange_wrapper.cursor_type)
is
v_tab My_numberrange := My_numberrange();
refc numberrange_wrapper.cursor_type2;
BEGIN
numberrange_wrapper.v_userid:= userid;
OPEN p_recordset FOR
SELECT
* FROM
Table(Cast(v_tab As My_numberrange));
P_Numbermgr_Api.reserveNumbers (My_numberrange,v_userid,p_recordset);
END Getnumberrange;
end numberrange_wrapper;
it return
PLS-00330: invalid use of type name or subtype name
please help me how i will solve this problem -
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 -
How to call a function having OBJECT type as Return type
Hi,
I've the following function returning OBJECT type.
Pease advice me how to call this function
CREATE OR REPLACE TYPE GET_EMP_OBJ is object
( emp_name varchar2(50) ,
mgr_id number,
dept_id number
CREATE OR REPLACE FUNCTION get_emp(P_emp_no NUMBER )
RETURN GET_EMP_OBJ IS
t_emp_info GET_EMP_OBJ ;
v_ename EMP.ename%TYPE;
v_mgr EMP.mgr%TYPE ;
v_deptno EMP.deptno%TYPE;
v_ename1 EMP.ename%TYPE;
v_mgr1 EMP.mgr%TYPE ;
v_deptno1 EMP.deptno%TYPE;
BEGIN
FOR rec IN ( SELECT ename , mgr , deptno
FROM emp )
LOOP
v_ename := rec.ename ;
v_ename1 := v_ename1||'|'||v_ename ;
v_mgr := rec.mgr ;
v_mgr1 := v_mgr1||'|'||v_mgr ;
v_deptno:= rec.deptno;
v_deptno1 := v_deptno1||'|'||v_deptno ;
END LOOP ;
t_emp_info := GET_EMP_OBJ (v_ename,v_mgr,v_deptno ) ;
RETURN t_emp_info ;
EXCEPTION WHEN OTHERS THEN
DBMS_OUTPUT.put_line ('Error'||SQLCODE||','||SQLERRM ) ;
END;The above function got created successfully.
And i'm confused how to call this functions. I tried like below but didn't work
DECLARE
t_emp_info_1 GET_EMP_OBJ ;
BEGIN
t_emp_info_1 := get_emp(7566) ;
for i in 1..t_emp_info_1.COUNT
LOOP
DBMS_OUTPUT.put_line ('Values are'||i.emp_name ) ;
END LOOP;
END;SQL> CREATE OR REPLACE TYPE GET_EMP_OBJ is object
2 ( emp_name varchar2(50) ,
3 mgr_id number,
4 dept_id number
5 );
6 /
Type created.
SQL> ed
Wrote file afiedt.buf
1 CREATE OR REPLACE FUNCTION get_emp(empno NUMBER )
2 RETURN GET_EMP_OBJ IS
3 t_emp_info GET_EMP_OBJ ;
4 BEGIN
5 begin
6 select get_emp_obj(ename, mgr, deptno) into t_emp_info
7 from emp
8 where empno = get_emp.empno;
9 exception
10 when no_data_found then
11 t_emp_info := new get_emp_obj(null,null,null);
12 end;
13 return t_emp_info;
14* END;
SQL> /
Function created.
SQL> set serverout on
SQL>
SQL> declare
2 t_emp_info GET_EMP_OBJ ;
3 BEGIN
4 t_emp_info := get_emp(7566);
5 DBMS_OUTPUT.put_line ('Values are: '||t_emp_info.emp_name||', '||t_emp_info.mgr_id||', '||t_emp_info.dept_id);
6 END;
7 /
Values are: JONES, 7839, 20
PL/SQL procedure successfully completed.
SQL> -
How do i change axis label object type from label to text? (to allow wrapping)
In the example of a barChart, how does one change the LABEL type from "Label" to "Text"?
I am trying to allow for long labels to wrap (ie. multi-line labels), but the default object type of labels is "Label" (which are single-line only).
I have been researching this issue all day, and have enountered a similar situation for changing the Legend component labels where a method override is implemented in a custom itemRenderer.
But I have not been able to figure out how to do this for an Axis label.
Any help would be greatly appreciated!
JYes, thank you. I am aware of the AxisRenderer.... but I'm not sure how to implement it to change the label type from "Label" to "Text" to allow for wrapping.
I guess what I'm looking for is a good example.... -
MASS - how to add more tables to object types
I am setting up a variant in the MASS transaction and I need to add the VBUP / order line item status table to the Object Type BUS2032 - sales orders. How can I add another table to this? Currently VBAK, VBKD and VBAP are available.
Thank you,
Lisa> Hi Lisa,
> I feel you are tyring out something which cannot be
> done.
> MASS will allow you to make a large number of changes
> at one go by creating a BDC.
> Now if you cannot do the change manually then you
> cant do it using MASS.
>
> So trying to maintain VBUP thru MASS will not work.
> You may need to find out the field in VBAP which
> would trigger the VBUP updation in your scenario.
>
> Reward points if this clarifies your question.
> regards
> Biju
Hello Biju,
MASS is doing what I want it to do. I can upload a file of sales orders that have not been delivered. I can then change the line item pricing date using MASS, and that will trigger the Carry Out New Pricing function.
I just wanted to add the delivery-status field to the select options screen in MASS. I don't want to change the delivery-status field value. I know that BUS2032 is SAP-delivered, but it it possible to copy that object to ZBUS2032 and then add the VBUP table for my selection criteria?
Thank you,
Lisa -
How to Convert OBJECT_TYPE to the Object Type Used for DBMS_METADATA?
How do you convert the object type in ALL_OBJECTS to the object type that DBMA_METADATA.GET_DDL expects?
Thanks,
Kurzmaybe one needs to find a mapping between sys.metaview$ and all_objects:
SQL> select type, xmltag, udt, viewname from sys.metaview$ where type like '%PACKAGE%'
TYPE XMLTAG UDT VIEWNAME
DE_S_PACKAGE
DE_S_COMP_PACKAGE
DE_S_COMP_PACKAGE2
DE_S_COMP_PACKAGE_SPEC
DE_S_PACKAGE_BODY1
DE_S_PACKAGE_BODY
SE_PACKAGE
SE_COMP_PACKAGE
SE_COMP_PACKAGE2
SE_COMP_PACKAGE_SPEC
SE_PACKAGE_BODY
PACKAGE PACKAGE_T KU$_PROC_T KU$_PKG_VIEW
PACKAGE PACKAGE_BODY_T KU$_PROC_T KU$_PKGBDY_VIEW
PACKAGE FULL_PACKAGE_T KU$_FULL_PKG_T KU$_FULL_PKG_VIEW
PACKAGE_SPEC PACKAGE_T KU$_PROC_T KU$_PKG_VIEW
PACKAGE_BODY PACKAGE_BODY_T KU$_EXP_PKG_BODY_T KU$_EXP_PKG_BODY_VIEW
ALTER_PACKAGE_SPEC ALTER_PACKAGE_SPEC_T KU$_ALTER_PROC_T KU$_ALTER_PKGSPC_VIEW
ALTER_PACKAGE_BODY ALTER_PACKAGE_BODY_T KU$_ALTER_PROC_T KU$_ALTER_PKGBDY_VIEW
18 rows selected. -
How to user jdbc visit oracle object type function?
1ãcreate oracle object
create type cocotestparam1 as object
(id number,
name varchar(10)
2ãadd function to object
alter type cocotestparam1 add member function test1(t number) return member;
3ãcreate object body
create type body cocotestparam1 as
memeber function test1(t number)
return number
is
begin
return t;
end;
end;
how can I visit the object cocotestparam1's function?
and how can I user jdbc visit the function?CallableStatement =
"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 -
Object type, how to search in OWB
Hi,
We have got a list of object types, which will be affected from a license-change.
e.g.: XML Files as a target, Operators for pluggable mapping....
So how do I search for such object-types, to see, if we have such in our OWB-World ?
thx for any hint.
kancomTry this line instead
query_type.Value ="*='Account'*";
instead of
query_type.Value ="Account";
Means make it like a search criteria like in SQL,ie., equals followed by single quoted sometext *='sometext'*
Let me know if that worked....
Regards,
Deepak H Andeli -
TYPE OR TABLE DEPENDENCY OF OBJECT TYPE (ORA-2303)
제품 : SQL*PLUS
작성날짜 : 2004-05-20
==================================================
TYPE OR TABLE DEPENDENCY OF OBJECT TYPE (ORA-2303)
==================================================
PURPOSE
Type이나 table의 dependency가 있는 type을 drop하거나 replace하고자
하면 ORA-02303 error가 난다. 이 error의 원인을 알아보도록 한다.
Explanation
Object의 attribute나 method를 수정하기 위해서는 object type을 drop하고 재생성
해야 한다. Type이나 table의 dependency가 있는 type을 drop하거나 replace하고자
하면 ORA-02303 error가 난다. Object type은 type (nested table 또는 VARRAY)
또는 object table로써 구체적으로 표현된다. 만약 data의 보존이 필요하다면
temporary table에 manual하게 옮겨놓아야 한다.
SQL Reference guide에 의하면 DROP TYPE FORCE 옵션은 recommend하지 않는다.
왜냐하면 이 옵션을 쓰게 되면 복구가 불가능하고 dependency가 있던 table들은
access하지 못하는 결과를 초래한다.
Example
아래의 query 1, 2, 3은 dependency을 확인하는 query문이다.
1. Find nested tables
select owner, parent_table_name, parent_table_column
from dba_nested_tables
where (table_type_owner, table_type_name) in
(select owner, type_name
from dba_coll_types
where elem_type_owner = '<typeOwner>'
and elem_type_name = '<typeName>');
2. Find VARRAYs
select owner, parent_table_name, parent_table_column
from dba_varrays
where (type_owner, type_name) in
(select owner, type_name
from dba_coll_types
where elem_type_owner = '<typeOwner>'
and elem_type_name = '<typeName');
3. Find object tables
select owner, table_name
from dba_object_tables
where table_type_owner = '<typeOwner>'
and table_type = '<typeName>'
and nested = 'NO';
Example ) Logon as Scott
/* Create an user defined object type */
SQL> create type object_type as object (
col1 number,
col2 varchar2(20))
Type created.
/* Create nested table type */
SQL> create type object_ntable as table of object_type
Type created.
/* Create varray type*/
SQL> create type object_varray as varray(5) of object_type
Type created.
/* Create parent table with nested table and varray */
SQL> create table master (
col1 number primary key,
col2_list object_ntable,
col3_list object_varray)
nested table col2_list store as master_col2
Table created.
/* Create object table */
SQL> create table object_table of object_type (col1 primary key)
object id primary key;
Table created.
ORA-2303 results if attempt to drop type with dependencies
SQL> drop type object_type;
drop type object_type
ERROR at line 1:
ORA-02303: cannot drop or replace a type with type or table dependents
위의 queery 1,2,3을 이용하여 object type dependency을 확인한다.
-- Find nested tables utilizing object type
SQL> select owner, parent_table_name, parent_table_column
from dba_nested_tables
where (table_type_owner, table_type_name) in
(select owner, type_name
from dba_coll_types
where elem_type_owner = 'SCOTT'
and elem_type_name = 'OBJECT_TYPE');
OWNER PARENT_TABLE_NAME PARENT_TABLE_COLUMN
SCOTT MASTER COL2_LIST
-- Find VARRAYs utilizing object type
SQL> select owner, parent_table_name, parent_table_column
from dba_varrays
where (type_owner, type_name) in
(select owner, type_name
from dba_coll_types
where elem_type_owner = 'SCOTT'
and elem_type_name = 'OBJECT_TYPE');
OWNER PARENT_TABLE_NAME PARENT_TABLE_COLUMN
SCOTT MASTER COL3_LIST
-- Find object tables
SQL> select owner, table_name
from dba_object_tables
where table_type_owner = 'SCOTT'
and table_type = 'OBJECT_TYPE'
and nested = 'NO';
OWNER TABLE_NAME
SCOTT OBJECT_TABLE
참고)
bulletin : 11576 처럼 utility을 이용하는 방법이 있다.
우리는 여기서 주의하여야 할 것은 script $ORACLE_HOME/rdbms/admin/utldtree.sql
을 내가 보고자 하는 user에서 돌려야 한다는 것이다.
$sqlplus scott/tiger
SQL> @$ORACLE_HOME/rdbms/admin/utldtree.sql
SQL> exec deptree_fill('TYPE','SCOTT','OBJECT_TYPE');
PL/SQL procedure successfully completed.
SQL> select * from ideptree;
DEPENDENCIES
TYPE SCOTT.OBJECT_TYPE
TYPE SCOTT.OBJECT_NTABLE
TABLE SCOTT.MASTER
TYPE SCOTT.OBJECT_VARRAY
TABLE SCOTT.MASTER
TABLE SCOTT.MASTER_COL2
TABLE SCOTT.OBJECT_TABLE
Reference Documents
Korean bulletin : 11576
<Note:69661.1>Hi Carsten,
Thanks for the sharp hint. It works.
However, when I create a table using the schema, it gives me this error:
varray DOC."LISTOFASSIGNEDNUMBER"."ASSIGNEDNUMBER"
ERROR at line 14:
ORA-02337: not an object type column
Here is the script:
CREATE TABLE CUSTOMMANIFEST (
ID NUMBER PRIMARY KEY,
DOC sys.XMLTYPE
xmltype column doc
XMLSCHEMA "http://www.abc.com/cm.xsd"
element "CustomManifest"
varray DOC."LISTOFMANIFESTPORTINFO"."MANIFESTPORTINFO"
store as table MANIFESTPORTINFO_TABLE
(primary key (NESTED_TABLE_ID, ARRAY_INDEX))
organization index overflow
varray DOC."LISTOFASSIGNEDNUMBER"."ASSIGNEDNUMBER"
store as table ASSIGNEDNUMBER_TABLE
(primary key (NESTED_TABLE_ID, ARRAY_INDEX))
organization index overflow
LISTOFASSIGNEDNUMBER itself is complexType and not sure where is the error....
You may note there are more than two hierachy/levels...
Thanks.
Maybe you are looking for
-
SSO to MOSS Microsoft SharePoint
Hi guys! I am currently trying to find out how to implemnt a SSO between SAP NetWeaver and the MOSS from Microsoft. EP is supposed to be the main host. Does anybody have any experience on this? Greets, Jan Marquardt
-
I started having trouble the past few days connecting to my Verizon e-mail (after clicking the internet explorer icon.) It seemed to take forever, and then today I waited and waited and then got a server error saying it couldn't tell me what the err
-
PDF Saving issue in Illustrator CS6 (Mac)
I have trouble saving Acrobat 4 compatible PDF files in Illustartor CS6. The problem does not affect every file I try to save, but when saving from AI to PDF, heavier files tend to be hard to save. I select the "Save as" option, click PDF, choose my
-
Hi all, I am in a scenario where i pick three files in BPM with correlations properly defined and input files also comply to the correlations. After i pick these 3 files a transformation step comes and finally a send step to send to an output file. W
-
Activating Order as Direct material button on Shopping cart screen
Hello SRM experts, we are in SRM 5.0. we implemented BADI: BBP_DP_PROD_CHK_BADI to suppress Order as direct material button on Shopping cart screen.in this BADI under PRODUCT_CHECK method we have this code CLEAR ev_dp_possible.Now the requirement is