SYS_PLSQL Object type !! bug!!
Hi,
I have got the following object type definition by using USER_TYPES dictionar
SQL> select dbms_metadata.get_ddl('TYPE', type_name, user) str
2 from user_types
3 where
4 type_name ='SYS_PLSQL_12564004_164_1'
5
CREATE OR REPLACE TYPE "test"."SYS_PLSQL_12564004_164_1" as object (
ER_KEY NUMBER,
ER_CODE VARCHAR2(20),
ER_TYPE VARCHAR2(20))
If this was generated by the system, how to correlate this object type with the package.
I hope, the pipelined function will have system generated names that starts with SYS_PLSQL*.
Please share your expertise. Oracle version is 11g R1.
Regards,
Boris
Edited by: user12075620 on Oct 10, 2012 11:57 PM
Edited by: user12075620 on Oct 11, 2012 12:04 AM
>
I have got the following object type definition by using USER_TYPES dictionar
SQL> select dbms_metadata.get_ddl('TYPE', type_name, user) str
2 from user_types
3 where
4 type_name ='SYS_PLSQL_12564004_164_1'
5
CREATE OR REPLACE TYPE "test"."SYS_PLSQL_12564004_164_1" as object (
ER_KEY NUMBER,
ER_CODE VARCHAR2(20),
ER_TYPE VARCHAR2(20))
If this was generated by the system, how to correlate this object type with the package.
I hope, the pipelined function will have system generated names that starts with SYS_PLSQL*.
Please share your expertise. Oracle version is 11g R1.
>
If you are asking how to find the package that created that TYPE then I don't know.
Particularly for PIPELINED functions Oracle will create SQL types based on PL/SQL types that are declared in a package spec. See Solomon's example of this
Re: Pipe line function
He showed that a user that does not have the privilege to create TYPEs will still have types created this way.
>
As you can see, user u1 was able to create types without create type privilege.
>
In 10g the types are visible but in 11g Rel 2 they are hidden.
I haven't been able to find any link between the package and system generated types. There is no linkage in PUBLIC_DEPENDENCY and I could not find any link in the system tables.
Worse is that testing shows that if you delete the system generated type it will NOT invalidate the package. But if you then try to use it you will get an exception.
drop type SYS_PLSQL_53616_9_1
ORA-06553: PLS-752: Table function GET_EMP is in an inconsistent state.
alter package pkg1 compile
Similar Messages
-
InsertXML -distinct object types only? bug?
Hi, I downloaded the XML SQL Utility v1.1.0 and I am trying to
use insertXML to insert into Oracle 8.1.5 database. The insert
raised an exception when I inserted into a view with 2 vyearkey_t
types. But if I created one more type called vyearkey2_t and use
vyearkey_t and vyearkey2_t instead in the view, the insert
succeeded.
My question is, why can't I use vyearkey_t twice? Does it mean I
cannot reuse the object types in the view?
Also, is there a site where I can find the list of bugs that
have been discovered or fixed?
Below are the view and the types.
Thanks in advance for your help!
-- AL.
create type vyearkey_t as object(
vyear varchar2(4),
vkey number
create type vyearkey2_t as object(
vyear varchar2(4),
vkey number
create or replace view myview_ov as
select vyearkey_t( t.year, t.key) VDK1,
vyearkey2_t( t2.year, t2.key) VDK2
from vdate_tab t, vdate_tab2 t2
where t.key = t2.key
CREATE OR REPLACE TRIGGER myview_trig
INSTEAD OF INSERT on myview_ov
DECLARE
BEGIN
insert into vdate_tab(year, key) values
(:new.VDK1.VYEAR, :new.VDK1.VKEY);
END;
nullHi AL,
Yes, this is indeed a bug that was introduced in the 1.1
version due to caching of metadata internally. We will fix this
and release a patch soon,
Thx
Oracle XML team
AL (guest) wrote:
: Hi, I downloaded the XML SQL Utility v1.1.0 and I am trying
to
: use insertXML to insert into Oracle 8.1.5 database. The insert
: raised an exception when I inserted into a view with 2
vyearkey_t
: types. But if I created one more type called vyearkey2_t and
use
: vyearkey_t and vyearkey2_t instead in the view, the insert
: succeeded.
: My question is, why can't I use vyearkey_t twice? Does it mean
I
: cannot reuse the object types in the view?
: Also, is there a site where I can find the list of bugs that
: have been discovered or fixed?
: Below are the view and the types.
: Thanks in advance for your help!
: -- AL.
: create type vyearkey_t as object(
: vyear varchar2(4),
: vkey number
: create type vyearkey2_t as object(
: vyear varchar2(4),
: vkey number
: create or replace view myview_ov as
: select vyearkey_t( t.year, t.key) VDK1,
: vyearkey2_t( t2.year, t2.key) VDK2
: from vdate_tab t, vdate_tab2 t2
: where t.key = t2.key
: CREATE OR REPLACE TRIGGER myview_trig
: INSTEAD OF INSERT on myview_ov
: DECLARE
: BEGIN
: insert into vdate_tab(year, key) values
: (:new.VDK1.VYEAR, :new.VDK1.VKEY);
: END;
Oracle Technology Network
http://technet.oracle.com
null -
Cannot call member function on object type
On 8.1.6 I cannot call a member function from SQL in the way described in the manual.
The following example is almost copied from the manual:
create or replace TYPE foo AS OBJECT (a1 NUMBER,
MEMBER FUNCTION getbar RETURN NUMBER);
create or replace type body foo is
MEMBER FUNCTION getbar RETURN NUMBER is
begin
return 45;
end;
end;
CREATE TABLE footab(col foo);
SELECT col,foo.getbar(col) FROM footab; -- OK
select col,col.getbar() from footab; -- ERROR
The second select is the way it should be, but I get an error "invalid column name".
Using the first select, I get the result. This is strange because this is more or less the 'static member' notation (filling in the implicit self parameter myself).
Is this a known bug in 8.1.6, maybe fixed in later versions?Konstantin,
Did you use loadjava to load the compiled class into the Oracle Database?
Regards,
Geoff
Hello!
I need to write a member function for object type with java.
for example:
create type test as object(
id number,
name varchar2(20),
member function hallo return number);
create type body test as
member function hallo return number
as language java
name 'test.hallo() return int;
create table test of test;
My java-file is:
public class test {
public int hallo() {
return 5;
select t.hallo() from test t;
It's does not run. Why?
I get always an error back. Wrong types or numbers of parameters!!
please help me.
thanks in advance
Konstantin -
8.1.7 jdbc driver: object types with double quotes
Hi all,
While switching from 8.1.6 to 8.1.7 I have trouble with the jdbc driver. It doesn't work
as before: The function CallableStatement.registerOutParameter (and probably some other) doesn't take object type
names in double quotes anymore. A test program is appended to this message. Using a 8.1.6 jdbc driver this program works fine but with a 8.1.7 jdbc driver it throws an exception.
My questions are: Is this bug already filed?
Is a bugfix already available somewhere?
Thanks in advance for any information
Joerg
import java.sql.*;
* create type "test_t" as object (atrb number(10));
* create table "test" of "test_t" (atrb not null) oidindex();
class test
public static void main (String args [])
throws SQLException
String s = "begin insert into \"test\" t values (1)" +
" returning ref(t) into ?; end;";
try{
DriverManager.registerDriver(new
oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection
("jdbc:oracle:thin:@host:1521:orcl","joerg", "password");
CallableStatement cs = conn.prepareCall( s );
cs.registerOutParameter(1, Types.REF, "\"test_t\"");
cs.execute();
System.out.println("Statement returned:");
System.out.println( cs.getObject(1) );
cs.close();
conn.commit();
conn.close();
catch(SQLException e){
System.out.println("SQLException was thrown...");
System.out.println(e.getMessage());
}I believe that typenames are always treated as case sensitive (unless they are all uppercased).
In your example you should write:
cs.registerOutParameter(1, Types.REF, "test_t");
If you had declared the type test_t in a case insensitive way (without "..."), then you'd have to write:
cs.registerOutParameter(1, Types.REF, "TEST_T");
If you have a schema-qualified name, use a ".":
cs.registerOutParameter(1, Types.REF, "SCOTT.test_t");
However, this behavior implies that you cannot use "." inside of quoted identifier names. -
JDBC & changed object type in nested table
Once I add new column in object type in nested table.. I did step by step like it was wrinten in OraDoc..convert data e.t.c
All programs work fine exept JDBC drivers..I decompile it and it's crashing on oracle.sql.ArrayDescriptor.java in metod
private int toLengthFromLocator(byte abyte0[])
after trying to execute this strane query in this method:
oraclepreparedstatement = (OraclePreparedStatement)m_conn.prepareStatement("SELECT count(*) FROM TABLE( CAST(? AS " + getName() + ") )");
this method exist and crash in 90 and 92 drivers.. maybe oracleTypeCOLLECTION.java
public Datum unlinearize(byte abyte0[], long l, Datum datum, long l1, int i, work incorrect.. and cause call of this method..
2driver developers: please trace your code with changed nested tabledamn... nobody reply me.. but this bug fixed on metalinc..
-
DISTINCT on object type collection not working with GROUP BY
Hello,
I have an object type with collection defined as:
create or replace type individu_ot as object (
numero_dossier number(10),
code_utilisateur varchar2(8 char),
nom varchar2(25 char),
prenom varchar2(25 char),
map member function individu_map return number
create or replace type body individu_ot is
map member function individu_map return number
is
begin
return SELF.numero_dossier;
end individu_map;
end;
create or replace type individu_ntt is table of individu_ot
/When I use it in simple SQL without any aggregation, the distinct keyword works well and returns me the distinct entry of my object type in the collection:
SQL> select cast(collect(distinct individu_ot(indivmc.numero_dossier, indivmc.idul, indivmc.nom, indivmc.prenom)) as individu_ntt) as distinct_list
from site_section_cours sisc
inner join enseignant_section_mc ensemc
on sisc.code_session = ensemc.code_session and
sisc.numero_reference_section_cours = ensemc.numero_reference_section_cours
inner join individu_mc indivmc
on ensemc.numero_dossier_pidm = indivmc.numero_dossier
where sisc.seq_site_cours = 6
DISTINCT_LIST(NUMERO_DOSSIER,CODE_UTILISATEUR,NOM,PRENOM)
INDIVIDU_NTT(INDIVIDU_OT(15,PROF5,Amidala,Padmé))
1 row selected.However in SQL with broader selection with group by, the distinct isn't working anymore.
SQL> select *
from (
select sisc.seq_site_cours,
cast(collect(distinct individu_ot(indivmc.numero_dossier, indivmc.idul, indivmc.nom, indivmc.prenom)) as individu_ntt) as distinct_list
from site_section_cours sisc
inner join enseignant_section_mc ensemc
on sisc.code_session = ensemc.code_session and
sisc.numero_reference_section_cours = ensemc.numero_reference_section_cours
inner join individu_mc indivmc
on ensemc.numero_dossier_pidm = indivmc.numero_dossier
group by sisc.seq_site_cours
where seq_site_cours = 6
SEQ_SITE_COURS DISTINCT_LIST(NUMERO_DOSSIER,CODE_UTILISATEUR,NOM,PRENOM)
6 INDIVIDU_NTT(INDIVIDU_OT(15,PROF5,Amidala,Padmé),INDIVIDU_OT(15,PROF5,Amidala,Padmé),INDIVIDU_OT(15,PROF5,Amidala,Padmé),INDIVIDU_OT(15,PROF5,Amidala,Padmé),INDIVIDU_OT(15,PROF5,Amidala,Padmé))
1 row selected.there is case where I need to return more than one collections, with distinct entries in it.
Is there something I am missing?
Thanks
BrunoNot a bug, rather an undocumented feature.
Here are some alternatives you might want to test :
1) Using the SET operator to eliminate duplicates :
SELECT sisc.seq_site_cours,
set(
cast(
collect(individu_ot(indivmc.numero_dossier, indivmc.idul, indivmc.nom, indivmc.prenom))
as individu_ntt
) as distinct_list
FROM site_section_cours sisc
INNER JOIN enseignant_section_mc ensemc
ON sisc.code_session = ensemc.code_session
AND sisc.numero_reference_section_cours = ensemc.numero_reference_section_cours
INNER JOIN individu_mc indivmc
ON ensemc.numero_dossier_pidm = indivmc.numero_dossier
GROUP BY sisc.seq_site_cours
;2) Using MULTISET with a subquery
SELECT sisc.seq_site_cours,
CAST(
MULTISET(
SELECT distinct
indivmc.numero_dossier, indivmc.idul, indivmc.nom, indivmc.prenom
FROM enseignant_section_mc ensemc
INNER JOIN individu_mc indivmc
ON ensemc.numero_dossier_pidm = indivmc.numero_dossier
WHERE sisc.code_session = ensemc.code_session
AND sisc.numero_reference_section_cours = ensemc.numero_reference_section_cours
AS individu_ntt
) AS distinct_list
FROM site_section_cours sisc
; -
Oracle JDBC driver and the object types cache
Hi there,
Oracle JDBC Developer's Guide and Reference says (version 11gR1):
Oracle JDBC drivers cache array and structure descriptors. This provides enormous performance benefits. However, it means that if you change the underlying type definition of a structure type in the database, the cached descriptor for that structure type will become stale and your application will receive a SQLException exception.http://download.oracle.com/docs/cd/B28359_01/java.111/b31224/oraoot.htm#g1104293
That is the problem we are having here... We have web services deployed to WebLogic server that use custom object types. Every time we have to change an object type definition the web services stop working (the error ORA-00902: invalid datatype is raised) and the only solution is to restart the JDBC data source which is quite disruptive to the development process.
Is there a workaround to disable that "feature"?
Thanks
LuisLuis Cabral wrote:
jschell wrote:
Although if you are changing the object structure then the code to deal with it must change as well. So, especially in developement, why is restarting a problem?It is not that restarting per se is a problem. Here us developers do not have the required privileges to restart the JDBC pool and we have to ask the DBA to do it, and sometimes he is not immediately available. It is not a big thing but this can impact the development process.Your development process is hideously flawed then.
The pool exists in the JEE server. And from your first post it seems that you have permission to restart that but not to access the management console. It is ridiculous to have access the the former and not the later.
Not to mention that you should have your own JEE instance to develop on. Actually it is weird to me that a DBA would even be touching a JEE server. The competent ones I know don't even know how to do that. They know the database not the application servers.
>
In addition, having to restart a whole JDBC pool just because you changed a database object definition does not seem very flexible to me. Such issue does not exist in other connection types, for instance in OCI connections, that is why I thought there should be an option to turn it off if required.
Well specifically you have to restart the pool because you were USING the object that changed.
And I am rather certain that you can turn off the pool entirely.
Even in production, I reckon that this may have a negative impact. For instance, say that you need to deploy a hot fix for a bug in one application that involves the re-creation of one single object type. This means that the whole JDBC pool, which may be used by other applications, may have to be shut down just because of that single object.Good point.
I suggest you stop using complex objects in Oracle. I suspect that would eliminate the problem completely. -
Error in creation of Object Type from XML passed
Hi,
I am facing a problem creating a appropriate a object type for a XML.
Below are the details:
XML Passed
<mer_offer_action_data>
<form_id>
134039588
</form_id>
<action_cd>
OA
</action_cd>
<offer_decline_reason_cd>
</offer_decline_reason_cd>
<start_dt>
</start_dt>
<candidate>
<ds_prs_id>
109315
</ds_prs_id>
<ds_prs_id>
110534
</ds_prs_id>
<ds_prs_id>
110059
</ds_prs_id>
</candidate>
</mer_offer_action_data>
Types Declaration
+CREATE OR REPLACE type MER_OFF_CANDIDATE
AS
OBJECT
DS_PRS_ID NUMBER
CREATE OR REPLACE TYPE MER_OFF_CANDIDATE_t
AS
TABLE OF MER_OFF_CANDIDATE;
CREATE OR REPLACE type MER_OFFER_ACT_DATA
AS
OBJECT
FORM_ID NUMBER,
ACTION_CD VARCHAR2(6),
OFFER_DECLINE_REASON_CD VARCHAR2(6),
START_DT VARCHAR2(11),
CANDIDATE MER_OFF_CANDIDATE_t
CREATE OR REPLACE TYPE MER_OFFER_ACT_DATA_t
AS
TABLE OF MER_OFFER_ACT_DATA;
CREATE OR REPLACE type MER_OFFER_ACTION_DATA
AS
OBJECT
MER_OFF_ACT_DATA MER_OFFER_ACT_DATA_t
/+
My Declaration
+merOffActDataXML xmltype;
merOffActData MER_OFFER_ACTION_DATA := MER_OFFER_ACTION_DATA(MER_OFFER_ACT_DATA_t());+
Inside Pl/SQL block
+-- Converts XML data into user defined type for further processing of data
xmltype.toobject(merOffActDataXML,merOffActData);+
when I run the Pl/Sql block it gives me error
ORA-19031: XML element or attribute FORM_ID does not match any in type ORADBA.MER_OFFER_ACTION_DATA
which means the object type mapping is wrong
I would like to know whether the object type I had created is correct or not.
Thanks for your help
BedaBedabrata Patel wrote:
Below are the details:The details except for a description of the problem
I am facing a problem creating a appropriate a object type for a XML.And which error you are getting
Error in creation of Object Type http://download.oracle.com/docs/cd/E11882_01/server.112/e10880/toc.htm
And which version of Oracle you are getting the unknown error creating the unknown problem. -
Error in creation of Object Type
Hi,
I am facing a problem creating a appropriate a object type for a XML.
Below are the details:
XML Passed
<mer_offer_action_data>
<form_id>
134039588
</form_id>
<action_cd>
OA
</action_cd>
<offer_decline_reason_cd>
</offer_decline_reason_cd>
<start_dt>
</start_dt>
<candidate>
<ds_prs_id>
109315
</ds_prs_id>
<ds_prs_id>
110534
</ds_prs_id>
<ds_prs_id>
110059
</ds_prs_id>
</candidate>
</mer_offer_action_data>
Types Declaration
+CREATE OR REPLACE type MER_OFF_CANDIDATE
AS
OBJECT
DS_PRS_ID NUMBER
CREATE OR REPLACE TYPE MER_OFF_CANDIDATE_t
AS
TABLE OF MER_OFF_CANDIDATE;
CREATE OR REPLACE type MER_OFFER_ACT_DATA
AS
OBJECT
FORM_ID NUMBER,
ACTION_CD VARCHAR2(6),
OFFER_DECLINE_REASON_CD VARCHAR2(6),
START_DT VARCHAR2(11),
CANDIDATE MER_OFF_CANDIDATE_t
CREATE OR REPLACE TYPE MER_OFFER_ACT_DATA_t
AS
TABLE OF MER_OFFER_ACT_DATA;
CREATE OR REPLACE type MER_OFFER_ACTION_DATA
AS
OBJECT
MER_OFF_ACT_DATA MER_OFFER_ACT_DATA_t
/+
My Declaration
+merOffActDataXML xmltype;
merOffActData MER_OFFER_ACTION_DATA := MER_OFFER_ACTION_DATA(MER_OFFER_ACT_DATA_t());+
Inside Pl/SQL block
+-- Converts XML data into user defined type for further processing of data
xmltype.toobject(merOffActDataXML,merOffActData);+
Thanks for your help
Beda
Edited by: Bedabrata Patel on Jul 12, 2010 5:51 AMBedabrata Patel wrote:
Below are the details:The details except for a description of the problem
I am facing a problem creating a appropriate a object type for a XML.And which error you are getting
Error in creation of Object Type http://download.oracle.com/docs/cd/E11882_01/server.112/e10880/toc.htm
And which version of Oracle you are getting the unknown error creating the unknown problem. -
PL/SQL Object Type - Java oracle.jbo.domain
PL/SQL Object Type <-> Java oracle.jbo.domain
can anybody help me, getting my domains to work?
Following scenario:
in pl/sql we have an object type called MULTI_LANGUAGE. This type is used for storing multilingual texts as nested table in one(!) column.
So the object MULTI_LANGUAGE contains a member variable LANGUAGE_COLLECTION of type LANGUAGE_TABLE, which itself is a nested table of objects
of the type LANGUAGE_FIELD (this again is only a language id and the corresponding content)
Also the methods setContent(langID, langContent) and getContent(langId) are defined on Object MULTI_LANGUAGE.
For example: Table having primary key, 2 other columns and one column of object type MULTI_LANGAGE (=nested table of objects)
|ID|Column1|Column2| multilingual Column |
|--|---------------------------------------|
| | | | ------------------- |
| | | | | 1 | hello | |
| | | | ------------------- |
|1 | foo | bar | | 2 | hallo | | <- Row Nr 1
| | | | ------------------- |
| | | | | 3 | ola | |
| | | | ------------------- |
|--|-------|-------|-----------------------|
| | | | ------------------- |
| | | | | 1 | world | |
| | | | ------------------- |
|2 | abc | def | | 2 | welt | | <- Row Nr 2
| | | | ------------------- |
| | | | | 3 | ??? ;-) | |
| | | | ------------------- |
|--|-------|-------|-----------------------|Now i've tried to modell this structure as an oracle.jbo.domain.
class MultiLanguage extends Struct having this StructureDef:
attrs[(0)] = new DomainAttributeDef("LanguageColl", "LANGUAGE_COLL", 0, oracle.jbo.domain.Array.class, 2003, "ARRAY", -127, 0, false, "campusonlinepkg.common.LanguageField");
and
class LanguageField extends Struct having this StructureDef:
attrs[(0)] = new DomainAttributeDef("Id", "ID", 0, oracle.jbo.domain.Number.class, 2, "NUMERIC", -127, 0, false);
attrs[(1)] = new DomainAttributeDef("Content", "CONTENT", 1, java.lang.String.class, 12, "VARCHAR", -127, 4000, false);
Is there anything wrong with this StructureDef?
When running the BC-Browser with -Djbo.debugoutput=console -Djbo.jdbc.driver.verbose=true parameters I get suspect warnings when browsing the records
[196] Executing FAULT-IN...SELECT NR, NAME FROM B_THESAURI BThesauri WHERE NR=:1
[197] SQLException: SQLState(null) vendor code(17074)
[198] java.sql.SQLException: Ungültiges Namensmuster: XMLTEST.null
...snip: detail of stack...
[240] SQLException: SQLState(null) vendor code(17060)
[241] java.sql.SQLException: Deskriptor konnte nicht erstellt werden: Unable to resolve type "null"
...snip: detail of stack...
[280] Warning:No element type set on this array. Assuming java.lang.Object.
(XMLTEST is the name of the schema)
Seems as if the framework can't read the TypeDescriptor or does not know which descriptor to read (XMLTEST.null??)
Do I have to implement my own JboTypeMap?
Please help, I'm stuck.
Thanks in advance, ChristianThanks for your suggestion, but it seems to me as if there is one level missing.
in pl/sql I have following structure:
Struct MULTI_LANGUAGE (Object type) - outermost
Array LANGUAGE_TABLE (nested table type)
Struct LANGUAGE_FIELD (Object type simple) - innermostthe reason why i had to wrap another struct around the array was because it is not possible to define methods on a nested table. this is only possible on objects.
on the outermost object type (which holds the array of language fields) I needed to define following 2 methods for direct access:
getContent (langId in number) returns varchar2
setContent (langId in number, langContent in varchar2)
I would like to rebuild the same structure in java, because newly written java code should live in perfect harmony with legacy pl/sql code ;-)
Both applications (Java and pl/sql) have to access the same data as long as migration to java goes on.
Is this nested structure too much for a Domain?
Any other suggestions?
Thanks again, Christian -
How to sort a Vector that stores a particular object type, by an attribute?
Hi guys,
i need help on this problem that i'm having. i have a vector that stores a particular object type, and i would like to sort the elements in that vector alphabetically, by comparing the attribute contained in that element. here's the code:
Class that creates the object
public class Patient {
private String patientName, nameOfParent, phoneNumber;
private GregorianCalendar dateOfBirth;
private char sex;
private MedicalHistory medHistory;
public Patient (String patientName, String nameOfParent, String phoneNumber, GregorianCalendar dateOfBirth, char sex) {
this.patientName = patientName;
this.nameOfParent = nameOfParent;
this.phoneNumber = phoneNumber;
this.dateOfBirth = dateOfBirth;
this.sex = sex;
this.medHistory = new MedicalHistory();
Class that creates the Vector.
public class PatientDatabase {
private Vector <Patient> patientDB = new Vector <Patient> ();
private DateFunction date = new DateFunction();
public PatientDatabase () throws IOException{
String textLine;
BufferedReader console = new BufferedReader(new FileReader("patient.txt"));
while ((textLine = console.readLine()) != null) {
StringTokenizer inReader = new StringTokenizer(textLine,"\t");
if(inReader.countTokens() != 7)
throw new IOException("Invalid Input Format");
else {
String patientName = inReader.nextToken();
String nameOfParent = inReader.nextToken();
String phoneNum = inReader.nextToken();
int birthYear = Integer.parseInt(inReader.nextToken());
int birthMonth = Integer.parseInt(inReader.nextToken());
int birthDay = Integer.parseInt(inReader.nextToken());
char sex = inReader.nextToken().charAt(0);
GregorianCalendar dateOfBirth = new GregorianCalendar(birthYear, birthMonth, birthDay);
Patient newPatient = new Patient(patientName, nameOfParent, phoneNum, dateOfBirth, sex);
patientDB.addElement(newPatient);
console.close();
*note that the constructor actually reads a file and tokenizes each element to an attribute, and each attribute is passed through the constructor of the Patient class to instantiate the object. it then stores the object into the vector as an element.
based on this, i would like to sort the vector according to the object's patientName attribute, alphabetically. can anyone out there help me on this?
i have read most of the threads posted on this forum regarding similar issues, but i don't really understand on how the concept works and how would the Comparable be used to compare the patientName attributes.
Thanks for your help, guys!Are you sure that you will always sort for the patient's name throughout the application? If not, you should consider using Comparators rather than implement Comparable. For the latter, one usually should ensure that the compare() method is consistent with equals(). As for health applications it is likely that there are patients having the same name, reducing compare to the patient's name is hazardous.
Both, Comparator and Comparable are explained in Sun's Tutorial. -
OSB to Object Types: difference between NULL value and not available
Hello all,
I have a question about Object Types. More specifically, how to differentiate between an empty value (null) and a string not available.
This is my case:
I have created an object type with three parameters.
CREATE OR REPLACE TYPE OSB_EMP_OBJ_TYPE AS OBJECT
(EMP_ID NUMBER
,DEPT_ID NUMBER
,ORDER_ID NUMBER
,CONSTRUCTOR FUNCTION OSB_EMP_OBJ_TYPE
RETURN self as result
/I would like to see what happens when I put an empty string into emp_id, NULL into DEPT_ID and nothing into ORDER_ID.
To do so I have this test script:
declare
p_emp OSB_EMP_OBJ_TYPE := OSB_EMP_OBJ_TYPE();
begin
p_emp.EMP_ID := '';
p_emp.DEPT_ID := null;
-- p_emp.ORDER_ID := null;
if p_emp.EMP_ID is null
then
dbms_output.put_line('Empty');
end if;
if p_emp.DEPT_ID is null
then
dbms_output.put_line('NULL');
end if;
if p_emp.ORDER_ID is null
then
dbms_output.put_line('Not available');
end if;
end;The result of this is:
Empty
NULL
Not availableIt seems that Oracle treats all three situations alike. What I would like to achieve is a way to see that p_emp.ORDER_ID was not initialized.
To elaborate a bit: in our production system this procedure would be called from OSB and the object type would by the input for that procedure. Our database version is 10.2.0.5.0.
Our procedures look something like this:
procedure p_procedure ( p_emp in osb_emp_obj_type )
is
begin
do_something;
end;Can anyone tell me if there is a way to achieve this, so I can see whether or not a value in the object type was filled?
Thanks in advance!Darn...
Eventually we want to use this for an update procedure. The client gets all current data from the database by calling a webservice that (using OSB) selects the data from our database. What we want to achieve is that the client can update that data, by returning only the changed fields to an update procedure.
We then handle an empty tag to update the field to null, and we ignore missing tags.
OSB itself can handle this, but PL/SQL can't.
I'm now thinking of adding an indicator to each optional field (clear_field_yn). OSB can still check for empty tags or missing tags. When a tag is empty, it's corresponding indicator will be set to 'Y'. If the tag is missing, then it will be set to 'N'.
Is that a solution to consider, or is there a much simpler approach possible? -
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 -
Business object type for parked invoices
Hi,
We are using documentum to store documents that have been attached to business object types in SAP. The business object types are configured in transaction OAC3 to point to a pre-configured content repository.
Having this configuration allows the object type to use the "services for objects" option, enabling it to store attachments.
The business object types for invoices have been configured and we are able to store attachments. However this does not seem to work for "Parked invoices". The configuration in the "services for objects" component is not there and the feature to store the attachment is disabled.
As the configuration needs to be done for all object types that need to be able to store attachments, maybe someone here can indicate what the object type is for parked invoices. Alternatively, maybe there is a way to look up the various business object types.
Any help you can provide is appreciated.
Thanks.
Kind Regards,
GiwanHi ,
Thank You for your reply.
I created inquiry . it takes BUS2031.But BUS2031 is used for quotation.But that inquiry is open in VA12(Change Inquiry) Transaction,not open in VA22(Change Quotation).
Is there any setting for BOR object types to Document Types.
Please give me a reply as early as possible.It's very urgent.
Thanks,
Saritha -
Expression or Function as field in Object Type
I am trying to use an expression or call a function as a return value for a field in an OBJECT TYPE.
Here's the obj def:
CREATE OR REPLACE TYPE OUTAGE_REPEAT_CALL_T2 AS OBJECT (
INITCALL_TS DATE,
LASTCALL_TS DATE,
CALL_SRC CHAR(8),
ELAPSED_TIME NUMBER,
REP_ID CHAR(8),
CALL_CNT NUMBER(3)
The ELAPSED_TIME field should be the differnece in minutes from the LASTCALL_TS and SYSDATE...
I'm not sure how to select into this OBJECT to get my result...
Sample table and data:
SQL> desc oms.outage_repeat_call
Name Null? Type
ACCT NOT NULL NUMBER(10)
INITCALL_TS NOT NULL DATE
LASTCALL_TS NOT NULL DATE
CALL_CNT NOT NULL NUMBER(3)
CALL_SRC NOT NULL CHAR(8)
REP_ID NOT NULL CHAR(8)
The ELAPSED_TIME is not part of the underlying table..
sample data from tbl:
ACCT INITCALL_ LASTCALL_ CALL_CNT CALL_SRC REP_ID
123456 02-JAN-02 02-JAN-02 1 CBIS MJB2302
I want to have this as a result:
INITCALL_ LASTCALL_ CALL_SRC ELAPSED_TIME REP_ID CALL_CNT
02-JAN-02 02-JAN-02 CBIS 9997 MJB2302 1
But by doing a select from the OBJECT TYPE:
i.e.
SELECT OUTAGE_REPEAT_CALL_T2( ORPC.INITCALL_TS,
ORPC.LASTCALL_TS,
ORPC.CALL_SRC,
'expression or func' AS ELAPSED_TIME,
ORPC.REP_ID,
ORPC.CALL_CNT)
FROM
OMS.OUTAGE_REPEAT_CALL ORPC
WHERE
ORPC.ACCT=123456;
I am using DBMS_XMLQUERY to eventually get this:
<?xml version = '1.0'?>
<ROWSET>
<ROW num="1">
<INITCALL_TS>1/2/2002 12:45:0</INITCALL_TS>
<LASTCALL_TS>1/2/2002 12:45:0</LASTCALL_TS>
<CALL_SRC>CBIS </CALL_SRC>
<ELAPSED_TIME>10009</ELAPSED_TIME>
<REP_ID>MJB2302 </REP_ID>
<CALL_CNT>1</CALL_CNT>
</ROW>
</ROWSET>
Here's the real query... this OBJECT TYPE is embedded as an attribute of another OBJECT TYPE def.
sQuery := 'SELECT '
|| iNumAcct || ' AS NUMACCT,
SITE_T(S.ACCT,
S.SITE,
S.PHONE,
S.CUST_NM,
S.MED_IND,
S.MAC_IND,
S.HPP_IND,
S.STREET,
S.CITY,
S.STATE,
S.ZIP,
S.EUC,
S.STATUS,
S.AGR_TYP,
S.PRICE_SCHED,
S.OL_IND,
S.TRANS_IND,
S.CIRCUIT,
S.SUBSTATION,
S.OP_CENTER,
OUTAGE_STATUS_T(O.OUT_ID,
O.OUT_STATUS,
O.PO_DEV,
O.DEV_TYP,
O.CREW,
O.ETOR_TS,
O.TRBL_CD,
O.FIRST_RPT_TS,
O.END_TS,
O.CUST_CNT,
O.O_CALL_CNT,
OUTAGE_REPEAT_CALL_T(ORC.INITCALL_TS,
ORC.LASTCALL_TS,
ORC.CALL_SRC,
ORC.REP_ID,
ORC.CALL_CNT),
LIGHT_REPEAT_CALL_T(LRC.INITCALL_TS,
LRC.LASTCALL_TS,
LRC.CALL_SRC,
LRC.REP_ID,
LRC.CALL_CNT)
) AS OUTCUST
FROM
OMS.SITE S,
OMS.OUTAGE O,
OMS.OUTAGE_REPEAT_CALL ORC,
OMS.LIGHT_REPEAT_CALL LRC,
OMS.OUTAGE_TRANSFORMER OT
WHERE
S.ACCT = ' || pi_acctNum || ' AND
S.TRNFRMR_ID = OT.TRNFRMR_ID(+) AND
OT.OUT_ID = O.OUT_ID(+) AND
S.ACCT = ORC.ACCT(+) AND
S.ACCT = LRC.ACCT(+)';
I know this may sound confusing...but I apprecitate anyone's/everyone's suggestions!
MJB
DUKEPOWER CO.yes... here's the function that I also used as the expression...
FUNCTION uf_minutesDiff(pi_beginDte IN VARCHAR2, pi_endDte IN VARCHAR2) RETURN NUMBER
|| FUNC name: uf_minutesDiff
|| purpose: this function accepts A BEGINNING DATE AND ENDING DATE AND
|| RETURNS THE DIFFERENCE IN MINUTES
||
|| date: 12/19/2001
|| author: Mark J Brooks
||
|| history:
||
||
IS
iMinutes NUMBER;
/* LINE 280 */
BEGIN
select (to_date(pi_endDte,'DD-MON-YYYY:HH24:MI') -
to_date(pi_beginDte,'DD-MON-YYYY:HH24:MI'))*24*60
INTO iMinutes from dual;
IF iMinutes = 0
THEN
iMinutes := 1;
END IF;
RETURN iMinutes;
END uf_minutesDiff;
I also just used:
SQL> SELECT OUTAGE_REPEAT_CALL_T2( ORPC.INITCALL_TS,
2 ORPC.LASTCALL_TS,
3 ORPC.CALL_SRC,
4 (ORPC.LASTCALL_TS - SYSDATE) AS ELAPSED_TIME,
5 ORPC.REP_ID,
6 ORPC.CALL_CNT)
7 FROM
8 OMS.OUTAGE_REPEAT_CALL ORPC
9 WHERE
10 ORPC.ACCT=123456;
(ORPC.LASTCALL_TS - SYSDATE) AS ELAPSED_TIME,
ERROR at line 4:
ORA-00907: missing right parenthesis
with and without the parens
tx
Maybe you are looking for
-
Lots of my music will no longer play after latest update
Hello, I have a lot of music that will no longer play in my iTunes after the last update. it doesnt happen with all my music, but a lot of it, and as far as i can tell, movies and tv shows are still good. when i click on the song, it just skips for
-
Trying to run SQLPlus: Unable to initialize Oracle call interface (again)
Dear all I am trying to install Oracle Instant Client on my powerpc-32bit running Linux. I just obtained these packages: instantclient-basic-linuxppc32-10.2.0.2-20060327.zip instantclient-sqlplus-linuxppc32-10.2.0.2-20060327.zip According to the docu
-
Hello, I am constantly (daily) getting this error Step 'DTSStep_ExecuteSQLTask_SC_EventFact_View_2_Insert' failed Step Error Source: Microsoft OLE DB Provider for SQL Server Step Error Description:Transaction (Process ID 57) was deadlocked on lock re
-
I have a completed imovie project of around 12mins. duration which I placed on desktop and opened Idvd.After previewing movie in Idvd seeing it through completely,I pressed burn disc(dvd-rw) and the process of burning takes place.In the correct time
-
Translation add-ons for safari
I'm looking for an add-ons for Safari to traslate by selecting and right-clicking over word or phrase. I used Firefox with add-ons gTranslate that use Google Translate service. Exist something for Safari too?