SQL & PL/SQL :: Unable To Override Parent Procedure

Jun 4, 2013

--Create a parent object
CREATE OR REPLACE TYPE PARENTOBJ AS OBJECT
(
FIRST_NAME VARCHAR2(50),
static function GETNAME return varchar2,
MEMBER PROCEDURE getoutput
)
NOT FINAL;
/

----Create the body for parent object type
CREATE OR REPLACE TYPE BODY PARENTOBJ AS
static function GETNAME return VARCHAR2 IS
BEGIN
RETURN 'PARENTOBJ';
END ;
MEMBER PROCEDURE getoutput iS
BEGIN
DBMS_OUTPUT.PUT_LINE( 'Hello world from '||PARENTOBJ.getname );
END ;
END;
/

--Create a child object
CREATE OR REPLACE TYPE CHILDOBJ UNDER PARENTOBJ
(
static function GETNAME return VARCHAR2,
--override the parent method
OVERRIDING MEMBER PROCEDURE getoutput
)
FINAL;
/

----Create the body for child object type
CREATE OR REPLACE TYPE BODY CHILDOBJ AS
static function GETNAME return VARCHAR2 IS
BEGIN
RETURN 'childobj';
END ;
--override the parent method
OVERRIDING MEMBER PROCEDURE getoutput IS
BEGIN
DBMS_OUTPUT.PUT_LINE( 'Hello world from '||CHILDOBJ.getname );

END;
END;
/

The above types are created with no issues. However, when I am trying to inherit the child method and override its parent, I am getting the follwoing error:-

--NOW INHERIT THE PARENT INTO CHILD, AND OVERRIDE THE PARENT METHOD BY CALLING THE CHILD METHOD
DECLARE
OBJ PARENTOBJ;
BEGIN
OBJ := NEW CHILDOBJ(NULL);
DBMS_OUTPUT.PUT_LINE('obj method getoutput() = ' || GETOUTPUT());
END;
/

ORA-06550: line 6, column 56:
PLS-00201: identifier 'GETOUTPUT' must be declared
ORA-06550: line 6, column 3:
PL/SQL: Statement ignored

View 7 Replies


ADVERTISEMENT

SQL & PL/SQL :: Unable To Override Nls_date_format For A Query?

Feb 2, 2011

We have nld_date_format set to dd-mon-rr at database level

While querying I am using to_date('08-SEP-81','dd-MON-yy') which is not giving me the desired results However using the date directly or with to_date('08-SEP-81','dd-MON-rr') is giving correct results

I was expecting using to_date('08-SEP-81','dd-MON-yy') will override the database or instance settings and will return the results.

SQL> set pages 100
SQL> select ename,hiredate from emp;
ENAME HIREDATE
---------- ---------
SMITH 17-DEC-80
ALLEN 20-FEB-81
WARD 22-FEB-81

[code]....

14 rows selected.

SQL> select ename from emp where hiredate>to_date('08-SEP-81','dd-MON-yy');

no rows selected

SQL> select ename from emp where hiredate>'08-SEP-81';

ENAME
----------
MARTIN
SCOTT
KING

[code]....

7 rows selected.

SQL> select value from nls_instance_parameters where parameter='NLS_DATE_FORMAT';
VALUE
SQL> select value from nls_database_parameters where parameter='NLS_DATE_FORMAT';
VALUE

[code]....

7 rows selected.

View 4 Replies View Related

SQL & PL/SQL :: How To Find Parent / Host Procedure Name Within Procedure

Sep 6, 2013

I have the following requirement.Say I have the following procedure created.create or replace procedure myproc (p1 varchar2, p2 varchar2) is begin

find_the_proc_name();
end;

In the above myproc, using find_the_proc_name() i should print the parent procedure name (or function) calling along with the parameters passed.

View 5 Replies View Related

SQL & PL/SQL :: Procedure To Get Path From Parent-child Relationship?

Apr 23, 2010

I have a table which uses parent-child relationship to store the options available. I need a procedure to give me the full path given the id of a particular option.

I have two different functions. One of them uses the Oracle built in function and the other uses simple queries with a loop.The code of the functions are given below.

Now, the problem is with their "performance". The difference in their performance is significant. The function using the Oracle function takes more than 2 hours to run a query whereas the other function takes less than 2 minutes.

I am having trouble trusting the other function. No matter how many tests I perform on the output of both the functions, it always comes out to be the same.

Function 1
=====================
FUNCTION Gettree (opt_id IN NUMBER,i_app_id IN NUMBER)
RETURN VARCHAR2
IS
path VARCHAR2(32767);
application_no NUMBER;
BEGIN

[code]...

View 2 Replies View Related

PL/SQL :: How To Update Parent And Child Tables While Updating Parent Table

Jun 13, 2012

I have a parent table EMPLOYEE which includes columns (sysid, serviceno,employeename...) sysid is Primary key, serviceno is Unique key and I have child table DEPENDENT includes columns (sysid,employee_sysid,name,dob...) here again SYSID is primary key for DEPENDENTS table, employee_sysid is Foreign key of EMPLOYEE table.

Now I want to change SYSID (using sequence) in EMPLOYEE table which need to be update in DEPENDENTS table as well

Note: I have 10000 records in EMPLOYEE table as well as I have 5 more child tables which need to update new SYSID.

View 5 Replies View Related

Application Express :: Override Default Row Processing?

Oct 16, 2012

I have created a form based on a table and I want to override the processing which inserts/updates the data in the database. I have figured out how to create a new process but I am having trouble referencing the form field data.

If I have a filed call P40_USERNAME how do I reference this in the insert/update statement in the custom process.

View 1 Replies View Related

SQL & PL/SQL :: Unable To Drop A Procedure?

Nov 29, 2012

I tried to Drop a procedure we have created, but an error is raised while droping it.

ora-04043 object does not exist

View 28 Replies View Related

Unable To Drop Procedure

Oct 29, 2013

i'm  issuing drop procedure  generatePasswordForEportalUser  

i have an

error ORA-00600:  [kqlobjlod-no-result-from-proc$], [1403], [659858], [], [], [], [], [], [], [], [], []. i found on metalink then  Doc ID 1267554.1 

  is about this error i'm using oracle 11.2.0.3  in this document there is an info that 11.2.0.2  solves the issue  Interesting thing is that select * from user_procedures where upper(object_name) like  upper ('generatePasswordForEportalUser');

generatePasswordForEportalUser6598581PROCEDURENONONONONODEFINERobject name is in lovercase it was created by create procedure generatePasswordForEportalUser  asbeginnull;end ;without " name "   why it is in lowercase in data dictionary

View 1 Replies View Related

Unable To Debug Procedure In 11g Database Using PL/SQL Developer

Mar 21, 2013

We have recently migrated our database from 10.2.0.4 to 11.2.0.2. We were able to debug procedures using PL/SQL Developer earlier but after 11g migration we are not able to debug the same procedure in 11g database.

Is it that we require 11g PL / SQL developer with 11g client installed to debug?

View 1 Replies View Related

SQL & PL/SQL :: Table Update - Unable To Identify Procedure

Feb 21, 2011

We have one table which is updated by some program but we are not able to identify the procedure, package or script which update it.

View 2 Replies View Related

Server Utilities :: Unable To Import One Procedure From Full Database Dump ( 10g )

Jun 20, 2008

i have full export dump file....from this, i need to import only one procedure belongs to schema : IC_MIGR_DATA... i need to import into SCHEMA : rep_user...

iam giving syntax:

impdp system/icg0ld@ICPRD directory=DUMPDIR dumpfile=IC_FULL_19062008.dmp logfile=imp_IC_FULL_190608.log schemas=rep_user parfile=imp_proc.par

parfile :
--------
INCLUDE=PROCEDURE:"LIKE 'IC_MIGR_DATA.JET_UPLIFT'"

while importing, iam getting below error,

*****[oracle10@AIICDELL IC]$ impdp system/icg0ld@ICPRD directory=DUMPDIR dumpfile=IC_FULL_19062008.dmp logfile=imp_IC_FULL_190608.log schemas=rep_user parfile=imp_proc.par

Import: Release 10.2.0.2.0 - 64bit Production on Friday, 20 June, 2008 16:19:46

Copyright (c) 2003, 2005, Oracle. All rights reserved.

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
ORA-39002: invalid operation
ORA-31694: master table "SYSTEM"."SYS_IMPORT_SCHEMA_01" failed to load/unload
ORA-31644: unable to position to block number 30698425 in dump file "/AIIC_backup/expbkp/dumps/IC/IC_FULL_19062008.dmp"
******

how to import this one procedure JET_UPLIFT , this has to be imported into REP_USER schema, owner of this procedure is IC_MIGR_DATA

View 5 Replies View Related

Parent Key Indexing

Jan 30, 2012

I have, for example, two tables: COMPANIES and EMPLOYEES. COMPANIES has a primary key on column COMP_ID. EMPLOYEES has a foreign key EMP_COMP_ID. I always do query COMPANIES with WHERE clause on COMP_ID and COMP_ADDRESS. What indexes on COMPANIES should I create in this case? First unique on COMP_ID, second composite on COMP_ID and COMP_ADDRESS? Or one unique index on COMP_ID and COMP_ADDRESS will be enough?

View 5 Replies View Related

SQL & PL/SQL :: Identifying Parent ID

Oct 22, 2011

I want to insert data from table A and dump into table B.The data in Table A looks like this:

Level_IDCode Type
ETY_1A......... 100000116
ETY_1B......... 100000116
ETY_1C......... 100000116
ETY_2AA........ 100000117
ETY_2AB........ 100000117
ETY_2AC........ 100000117
ETY_2BA........ 100000117
ETY_2BB........ 100000117
ETY_2BC........ 100000117
ETY_3AAA....... 100000118
ETY_3AAG....... 100000118
ETY_3AAI....... 100000118
ETY_3AAX....... 100000118
[code]....

And I want to dump the data into Table B which will look like this:

Level_ID Code Type Parent_cd
ETY_1A.........100000116null
ETY_1B.........100000116null
ETY_1C.........100000116null
ETY_2AA........100000117A
ETY_2AB........100000117A
ETY_2AC........100000117A
ETY_2BA........100000117B
ETY_2BB........100000117B
ETY_2BC........100000117B
ETY_3AAA.......100000118AA
ETY_3AAG.......100000118AA
ETY_3AAI.......100000118AA
[code]....

I need to populate a column called Parent Cd with the values that sits at the base level of the hierarchy. So, if the code A sits at the base level then its parent is NULL and the parent for code AA, AB, and AC will be A and parent for AAA, AAG will be AA and so on.The level_IDs are upto 10 and there are close to 400,000 records.

View 5 Replies View Related

Parent Child Relationship

May 13, 2011

Just wanted to pose a question Can a (Unique and Not nullable)Alternate key of the parent table be part of child Table in an Identifying relationship i.e part of primary key of a child table????

Is there a rule that a primary keys of a parent table can be used to build a identifying relationship with its child?

View 1 Replies View Related

SQL & PL/SQL :: Getting Parent And Leaf Child Along With ID

Jun 14, 2012

I've the following data and i need the parent and leaf most child,including their id's

Create table par_chld (id,p_id,c_id) as
(select 1,900,501 from dual union all
select 2,900,502 from dual union all
select 3,900,503 from dual union all
select 4,100,900 from dual union all
select 5,200,900 from dual union all
select 6,300,400 from dual union all
select 7,101,500 from dual union all
select 8,102,500 from dual union all
select 9,103,500 from dual union all
select 10,201,600 from dual union all
select 11,201,601 from dual union all
select 12,201,602 from dual )

In the above data
p_id =100 has c_id 900 , and this 900 acts as a parent which has child 501 , 502 ,503

And the output should be in the following format , Where i don't need the middle level data. I need parent and its leaf child along with the id's of parent and child

Expected output

id_p p_id id_c c_id

4 100 1 501
4 100 2 502
4 100 3 503
5 200 1 501
5 200 2 502
5 200 3 503
6 300 6 400
7 101 7 500
8 102 8 500
9 103 9 500
10 201 10 600
11 201 11 601
12 201 12 602

I tried the following query where i got the p_id,id_c,c_id columns , but unable to get the column id_p

select connect_by_root p_id p_id ,id id_c,c_id
from par_chld
where connect_by_isleaf =1
start with p_id not in (select c_id
from par_chld
where c_id is not null)
connect by nocycle p_id =prior c_id

getting the id_p column as expected above.

View 2 Replies View Related

SQL & PL/SQL :: Parent-Child Hierarchy?

Dec 20, 2012

way to achieve the below logic.

SQL to pick up parent child relationship within same table with a certain logic.

Example:
mod_product_numberProduct_Hierarchy
H555888 PH05678
H888987 H555888
H8889 H555888

[code]...

Example: I expect the rows with H8889,H9955 & P6666 & P5555 to be sub-category values value for product hierarchy H555888.

If there are rows with H8888987 as Product_hierarchy, we will pull up those rows too for product hierarchy H555888. The extra condition is we drill down only on 7 character mod_prod_number not on 5 character mod_prod_number. We pull out all sub category mod_prod_number for all distinct Product hierarchy.

View 11 Replies View Related

SQL & PL/SQL :: Parent Child Relation

Sep 17, 2013

I have one requirment like below

Table1 have records like below

parent childflag
null.....A......Y
A........B......Y
B........C
C........D
D........E......Y

I want it should be like

parent child flag
null......A.....Y
A.........B.....Y
B.........E.....Y

I want to replace 'D' (parent of 'E') with any of the upper level which has Flag 'Y' (first level parent which satisfy falg 'Y')

View 7 Replies View Related

PL/SQL :: Select Parent Records

Sep 3, 2012

Is there any SQL query which can return first value. I have 1 table, 2 columns: NR; created_from_nr;

Data:

Nr=L1 created_from_nr=''
Nr=L2 created_from_nr=L1
Nr=L3 created_from_nr=L2
Nr=L4 created_from_nr=L3

How can I get Nr=L1 if I know L4, with one query ?

View 3 Replies View Related

SQL & PL/SQL :: Parent Table Relationship

Feb 6, 2012

Would there be any problem / error when we import the dump file (which has parent table) on target database ?

View 11 Replies View Related

SQL & PL/SQL :: Creating Parent Child Relationship

Aug 8, 2011

I have a table called FAMILY which holda the data like , for father_gen_1 --->father_gen_2 --> father_gen_3 -- son.

father_gen_1 father_gen_2 father_gen_3 son
ABC XYZ GEF MNC
ABC lmn kth

I want to get the output which is a three column heirarical table and holds the parent child relationship Like following:-

id name parent_id
1 ABC NULL
2 XYZ 1
3 GEF 2
4 MNC 3
5 LMN 1
6 KTH 5

View 7 Replies View Related

SQL & PL/SQL :: Way Of Getting Only Parent And Child Record From Table

Jul 27, 2010

i have a table with data as follows:

select genres.* from genres

data is as follows

INTPRODUCTIDVCHGENRENAME INTGENREPAGEIDINTPARENTIDINTGENREID
14430015Biography 157 0100
14430015Classics & Poetry 173 0116
14430015Literature & Anthologies 175 173118

now when i give

select level,genres.* from genres connect by prior INTGENREPAGEID= INTPARENTID

i get

LEVELINTPRODUCTIDVCHGENRENAME INTGENREPAGEIDINTPARENTIDINTGENREID
114430015Biography 157 0100
114430015Classics & Poetry 173 0116
214430015Literature & Anthologies 175 173118
114430015Literature & Anthologies 175 173118

i need to find the parent and child from the table in this case the parent is Classics & Poetry and child is Literature & Anthologies..the way of getting only the parent and child record from this table.

View 5 Replies View Related

SQL & PL/SQL :: Parent And Child Table - Delete Row

May 18, 2010

I have a parent table and child table. I want a row to be deleted from the parent table which is referenced by a child row. Is there a way to achieve this. I dont have permission to re create the table or alter the table using delete cascade option. Is there a way to do it in sql.

SQL> create table t1(a number primary key, b number);
SQL> create table t2(c number, d number references t1(a));
SQL> insert into t1 values(1,2);
SQL> insert into t1 values(2,3);
SQL> insert into t1 values(3,4);
SQL> insert into t2 values(10,3);
SQL> insert into t2 values(20,2);
SQL> delete from t1 where a=2;
delete from t1 where a=2
*

ERROR at line 1:
ORA-02292: integrity constraint (CISBATCH.SYS_C00763501) violated - child
record found

View 11 Replies View Related

SQL & PL/SQL :: How To Delete Parent Table Record

Jul 10, 2012

how to delete Parent table records without affecting to child table dependent records?..

View 5 Replies View Related

SQL & PL/SQL :: Update Parent Child Table?

May 26, 2011

i want to update primary key of 1 master and 2 child table is it possible if i do it simultaniously if not

View 9 Replies View Related

SQL & PL/SQL :: Delete - Parent / Child Relationship

May 22, 2012

I have a DB that has one parent table with many child tables. I would like to delete all records(child - parent) based upon a particular "net_id". I have three versions that "seem" to work BUT I'd like to use "version2" because I want to go to the parent one time(for the parent delete I just made it simple for me) only and be able to delete the child record(s) from the child table(s). I want to achieve this w/o using triggers...

My question: Is version2 an "ok" way to delete child records or should I try another method(version1 or 3)??

create table PARENT
(
event_id NUMBER,
event_title VARCHAR2(50),
net_id VARCHAR2(16)
);

--truncate table parent;
insert into parent
(event_id, event_title, net_id)
values
(1, 'title1', 'CURLY');
[code]...

View 10 Replies View Related

SQL & PL/SQL :: ORA-02298 Cannot Validate - Parent Keys Not Found

Mar 6, 2012

i need to delete a record from table but it showed a error for foreign key constraint so i disabled the constraint and again deleted, now the row is deleted.

Again inserted another values instead the deleted value. after that i tried to alter the constraint but i received the error ORA-02298 cannot validate - Parent keys not found

alter table t1 enable constraint FK_T1;

But i am not able to enable the key. what to do?

View 6 Replies View Related

SQL & PL/SQL :: Delete Records From Child And Parent Table

Jan 2, 2013

I want to delete records from parent table which are less than 2 years. Before deleting records from parent table we have to delete records from child table. How can we delete those records. I don't want to use ON DELETE CASCADE.

MASS_MASTER --parent table.
MASS_CHILD --child table.

The below query is used to delete records from parent table.

DELETE FROM mass_master WHERE last_date<=ADD_MONTHS(sysdate,-24);

The child table MASS_CHILD is not having last_date column. provide me the query to delete same records from child table.

View 21 Replies View Related

SQL & PL/SQL :: Select Query To Return Parent Rows?

Apr 1, 2012

I need to get the super set(parent) record from a relational table. Following is the structure of the table,

create table relation (data_field1 number(20),data_field2 number(20),data_field3 number(20),

primary key (data_field1,data_field2,data_field3) );
insert into relation (data_field1, data_field2, data_field3) values (-10,123,334);
insert into relation (data_field1, data_field2, data_field3) values (200,123,334);
insert into relation (data_field1, data_field2, data_field3) values (300,123,334);
insert into relation (data_field1, data_field2, data_field3) values (400,123,334);

[code].....

Here '-10' will be considered as parent(super set) for all other values. If i have records like below,

-10 200 300
100 200 300
123 200 300
521 201 300

Output should only contain two rows. A super set row and other distinct row(second column value is not equivalent to super set).

View 14 Replies View Related

Forms :: How To Assign Value To Parent From Child Form

Feb 29, 2012

I have two forms, FormPARN, FormCHLD.

One Text item is there in FormPARN, near to that Text item, Button is there.While clicking Button FormCHLD will be opened. Inside the FormCHLD, i will do some calculation and i need to store the result in FormPARN's Text Item.

How can i do it?

View 10 Replies View Related

SQL & PL/SQL :: Connect To Get Parent And Supervisor Details In Oracle

Oct 15, 2013

I have a table like below:

EMP_ID MGR_ID EMP_NAME EMP_ROLE EMP_HIERARCHY
10 9 John Developer 7,8,9,10
9 8 Charlie Manager 7,8,9
8 7 Bruce GL 7,8
7 King CEO 7
20 18 Jack Developer 7,16,17,18,20
18 17 Adam Teamlead 7,16,17,18
17 16 Erik Manager 7,16,17
16 7 David GL 7,16

We can see that the for each employee, there is a corresponding Manager tagged except for CEO of the company. Now, I want the output to be like below

EMP_ID EMP_NAME EMP_ROLE MGR_ID MGR_NAME MGR_ROLE SUPERVISOR_ID SUPERVISOR_NAME SUPERVISOR_ROLE

Here, MGR_ID is nothing but the MGR_ID from the same row and Supervisor_id is nothing but the MGR_ID of MGR_ID

Ex:- For 10 EMP_ID, the MGR_ID = 9 and Supervisor_id = Mgrid of 9 i.e., 8
For 8, the Mgr_id = 7 and Supervisor_id = Mgrid of 7 which is none. etc.,

The same logic applies for Mgr_name, Mgr_Role , Supervisor_name and Supervisor_role too. I could not format the data in a tabular format due to some formatting issues.

View 12 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved