Oracle 8i - Connect By & Join problem
I've just learned how to use the Connect By statement, and I know you can't use it with a join. However, my goal end result requires joining two tables. Is there some way to include the Connect By statement in a subquery so I can get what I want?
The query I'd like to be able to do, but can't is:
SELECT
LEVEL,
C_BILL.COMP_PART_NBR,
C_PART.PART_DESC,
C_PART.PART_TYPE,
C_BILL.QTY_PER,
C_PART.QTY_ON_HAND,
C_BILL.OPER_NBR,
C_BILL.COMP_OFF_ADJ,
C_BILL.BOM_DOC_NBR,
P_PART.QTY_ON_HAND
FROM
BILL C_BILL,
PART C_PART,
PART P_PART
WHERE
C_PART.PART_NBR=C_BILL.COMP_PART_NBR AND
P_PART.PART_NBR=C_BILL.BOM_DOC_NBR AND
((C_BILL.STATUS = 'RL') AND
(C_BILL.VIEW_CODE!='E') AND
(C_BILL.QTY_PER_TYPE!=0) AND
(C_BILL.END_EFF_DT>sysdate) AND
(C_BILL.BEGN_EFF_DT<=sysdate))
START WITH C_BILL.BOM_DOC_NBR='ABC-123'
CONNECT BY PRIOR C_BILL.COMP_PART_NBR=C_BILL.BOM_DOC_NBR
ORDER BY
LEVEL,
C_BILL.BOM_DOC_NBRWhen I tried to do it with a subquery, I got no results, but most likely I messed something up in the sub-query (code pasted below):
SELECT
LEVEL,
C_BILL.COMP_PART_NBR,
C_PART.PART_DESC,
C_PART.PART_TYPE,
C_BILL.QTY_PER,
C_PART.QTY_ON_HAND,
C_BILL.OPER_NBR,
C_BILL.COMP_OFF_ADJ,
C_BILL.BOM_DOC_NBR,
P_PART.QTY_ON_HAND
FROM
BILL C_BILL,
PART C_PART,
PART P_PART
WHERE
C_PART.PART_NBR=C_BILL.COMP_PART_NBR AND
P_PART.PART_NBR=C_BILL.BOM_DOC_NBR AND
(LEVEL,
C_BILL.COMP_PART_NBR,
C_BILL.QTY_PER,
C_BILL.QTY_PER_TYPE,
C_BILL.OPER_NBR,
C_BILL.COMP_OFF_ADJ,
C_BILL.BOM_DOC_NBR)
IN
(SELECT
LEVEL,
C_BILL.COMP_PART_NBR,
C_BILL.QTY_PER,
C_BILL.QTY_PER_TYPE,
C_BILL.OPER_NBR,
C_BILL.COMP_OFF_ADJ,
C_BILL.BOM_DOC_NBR
FROM
BILL C_BILL
WHERE
((C_BILL.STATUS = 'RL') AND
(C_BILL.VIEW_CODE!='E') AND
(C_BILL.QTY_PER_TYPE!=0) AND
(C_BILL.END_EFF_DT>sysdate) AND
(C_BILL.BEGN_EFF_DT<=sysdate))
START WITH C_BILL.BOM_DOC_NBR='ABC-123'
CONNECT BY PRIOR C_BILL.COMP_PART_NBR=C_BILL.BOM_DOC_NBR)The code with the subquery didn't generate any errors, it just didn't return a single record.
Here's code for more sample data:
--Creating 3 tables: docm, part, bill
CREATE TABLE docm
doc_nbr varchar(25) not null,
doc_rev_nbr varchar(10) not null,
doc_type varchar(4) not null
CONSTRAINT docm_pk
PRIMARY KEY (doc_nbr, doc_rev_nbr, doc_type)
CREATE TABLE part
part_nbr varchar(25) not null,
cur_rev_cd varchar(10) not null,
part_desc varchar(25) not null,
part_type char(1) not null,
qty_on_hand double(13,4) not null
CONSTRAINT part_pk
PRIMARY KEY (part_nbr, cur_rev_cd),
CONSTRAINT check_part_type
CHECK (part_type IN ('M','P','X','Y')),
CONSTRAINT check_qty_on_hand
CHECK (qty_on_hand >= 0)
CREATE TABLE bill
row_added_ts char(20) not null,
bom_doc_nbr varchar(25) not null,
doc_rev varchar(10) not null,
doc_type char(4) not null,
comp_part_nbr varchar(25) not null,
cost_rev_cd varchar(10) not null,
qty_per double(9,5) not null,
qty_per_type char(1) not null,
oper_nbr char(4) not null,
comp_off_adj double(3,0),
status char(2),
view_code char(1) not null,
end_eff_dt date() not null,
begn_eff_dt date() not null
CONSTRAINT bill_pk
PRIMARY KEY (row_added_ts),
CONSTRAINT fk_docm
FOREIGN KEY (bom_doc_nbr, doc_rev, doc_type)
REFERENCES docm(doc_nbr, doc_rev_nbr, doc_type),
CONSTRAINT fk_part
FOREIGN KEY (comp_part_nbr, cost_rev_cd)
REFERENCES part(part_nbr, cur_rev_cd),
CONSTRAINT check_qty_per_type
CHECK (qty_per_type IN ('0','1','2','3')),
CONSTRAINT check_status
CHECK (status IN ('IN', 'RL')),
CONSTRAINT check_doc_type
CHECK (doc_type IN ('BILL')),
--Inserting values
INSERT INTO docm
VALUES ('ABC-123', ' ', 'BILL');
INSERT INTO docm
VALUES ('DEF-456', ' ', 'BILL');
INSERT INTO docm
VALUES ('XYZ-100', ' ', 'BILL');
INSERT INTO docm
VALUES ('(OPEN)', ' ', 'BILL');
INSERT INTO docm
VALUES ('XYZ-100-1', ' ', 'BILL');
INSERT INTO docm
VALUES ('XYZ-100-2', ' ', 'BILL');
INSERT INTO docm
VALUES ('XYZ-100-3', ' ', 'BILL');
INSERT INTO docm
VALUES ('XYZ-100-4', ' ', 'BILL');
INSERT INTO docm
VALUES ('XYZ-100-A', ' ', 'BILL');
INSERT INTO part
VALUES ('abc-1', ' ', 'purchased part', 'P', 5);
INSERT INTO part
VALUES ('abc-2', ' ', 'purchased part', 'P', 6);
INSERT INTO part
VALUES ('abc-3', ' ', 'purchased part', 'P', 2);
INSERT INTO part
VALUES ('def-1', ' ', 'purchased part', 'P', 3);
INSERT INTO part
VALUES ('def-2', ' ', 'purchased part', 'P', 4);
INSERT INTO part
VALUES ('xyz-1', ' ', 'purchased part', 'P', 5);
INSERT INTO part
VALUES ('xyz-2', ' ', 'purchased part', 'P', 1);
INSERT INTO part
VALUES ('xyz-3', ' ', 'purchased part', 'P', 1);
INSERT INTO part
VALUES ('xyz-4', ' ', 'purchased part', 'P', 1);
INSERT INTO part
VALUES ('raw-1', ' ', 'purchased raw material', 'P', 212);
INSERT INTO part
VALUES ('raw-2', ' ', 'purchased raw material', 'P', 75.5);
INSERT INTO part
VALUES ('ABC-123', ' ', 'manufactured part', 'M', 0);
INSERT INTO part
VALUES ('DEF-456',' ', 'manufactured part', 'M', 1);
INSERT INTO part
VALUES ('XYZ-100', ' ', 'manufactured part', 'M', 0);
INSERT INTO part
VALUES ('(OPEN)', ' ', '(not in use)', 'Y', 0);
INSERT INTO part
VALUES ('XYZ-100-1', ' ', 'manufactured part', 'M', 0);
INSERT INTO part
VALUES ('XYZ-100-2', ' ', 'manufactured part', 'M', 1);
INSERT INTO part
VALUES ('XYZ-100-3', ' ', 'manufactured part', 'M', 0);
INSERT INTO part
VALUES ('XYZ-100-4', ' ', 'manufactured part', 'M', 2);
INSERT INTO part
VALUES ('XYZ-100-A', ' ', 'manufactured part', 'M', 0);
INSERT INTO bill
VALUES ('2008071153100150000','(OPEN)',' ','BILL','abc-3',' ',2,'1','****',0,'RL','E','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008070753100150000','ABC-123',' ','BILL','abc-1',' ',2,'1','****',2,'RL','M','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008070953100150000','ABC-123',' ','BILL','abc-2',' ',4,'1','****',2,'RL','M','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008071153100150000','ABC-123',' ','BILL','abc-3',' ',2,'1','****',3,'RL','M','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008071153100150000','ABC-123',' ','BILL','(OPEN)',' ',4,'1','****',3,'RL','E','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008071353100150000','ABC-123',' ','BILL','XYZ-100',' ',2,'1','****',0,'RL','M','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008071553100150000','DEF-456',' ','BILL','def-1',' ',2,'1','****',1,'RL','M','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008071753100150000','DEF-456',' ','BILL','def-2',' ',1,'1','****',2,'RL','M','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008071953100150000','DEF-456',' ','BILL','XYZ-100',' ',1,'1','****',0,'RL','M','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008072153100150000','XYZ-100',' ','BILL','xyz-1',' ',3,'1','****',0,'RL','M','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008072153100150000','XYZ-100',' ','BILL','XYZ-100-1',' ',1,'1','****',0,'RL','M','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008072153100150000','XYZ-100-1',' ','BILL','xyz-1',' ',2,'1','****',1,'RL','M','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008072153100150000','XYZ-100-1',' ','BILL','XYZ-100-2',' ',3,'1','****',0,'RL','M','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008072153100150000','XYZ-100-2',' ','BILL','xyz-2',' ',6,'1','****',2,'RL','M','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008072153100150000','XYZ-100-2',' ','BILL','xyz-4',' ',6,'1','****',2,'IN','M','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008072153100150000','XYZ-100-2',' ','BILL','xyz-100-3',' ',1,'1','****',0,'RL','M','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008072153100150000','XYZ-100-3',' ','BILL','xyz-3',' ',8,'1','****',1,'RL','M','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008072153100150000','XYZ-100-3',' ','BILL','XYZ-100-4',' ',4,'1','****',0,'RL','M','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008072153100150000','XYZ-100-3',' ','BILL','XYZ-100-A',' ',2,'1','****',2,'RL','M','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008071153100150000','XYZ-100-3',' ','BILL','(OPEN)',' ',2,'1','****',0,'RL','E','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008072153100150000','XYZ-100-4',' ','BILL','raw-1',' ',8.75,'1','****',0,'RL','M','01-Jan-2050','01-Jan-1900');
INSERT INTO bill
VALUES ('2008072153100150000','XYZ-100-A',' ','BILL','raw-2',' ',3.75,'1','****',0,'RL','M','01-Jan-2050','01-Jan-1900');As for the view... with all the data above, the view is pretty large to post here (64 rows). Is there any way I can attach an Excel file or CSV file with the desired view results in it?
Similar Messages
-
Oracle 10G connection problem
I launch my db with the following script:
su - oracle -c "export ORACLE_HOME=/u01/app/oracle/product/10.1.0/db_1 && /u01/app/oracle/product/10.1.0/db_1/bin/dbstart"
su - oracle -c "export ORACLE_HOME=/u01/app/oracle/product/10.1.0/db_1 && /u01/app/oracle/product/10.1.0/db_1/bin/lsnrctl start"
Here is the output:
SQL*Plus: Release 10.1.0.2.0 - Production on Fri Feb 27 22:17:51 2004
Copyright (c) 1982, 2004, Oracle. All rights reserved.
SQL> Connected to an idle instance.
SQL> ORACLE instance started.
Total System Global Area 188743680 bytes
Fixed Size 778036 bytes
Variable Size 162537676 bytes
Database Buffers 25165824 bytes
Redo Buffers 262144 bytes
Database mounted.
Database opened.
SQL> Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
Database "orcl" warm started.
LSNRCTL for Linux: Version 10.1.0.2.0 - Production on 27-FEB-2004 22:17:59
Copyright (c) 1991, 2004, Oracle. All rights reserved.
Starting /u01/app/oracle/product/10.1.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.1.0.2.0 - Production
System parameter file is /u01/app/oracle/product/10.1.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/product/10.1.0/db_1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=xavan_fi
xe)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC))
STATUS of the LISTENER
Alias LISTENER
Version TNSLSNR for Linux: Version 10.1.0.2.0 - Production
Start Date 27-FEB-2004 22:17:59
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.1.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/10.1.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=xavan_fi
xe)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
But when i try to connect with sqlplus:
oracle@xavan_fixe oracle $ sqlplus
SQL*Plus: Release 10.1.0.2.0 - Production on Ven. Févr. 27 22:19:32 2004
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Enter user-name: scott
Enter password:
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux Error: 2: No such file or directoryWhen you go to get connection you have to set the ORACLE_SID enviroment variable or use the service name in the string to get connection.
Joel Pérez -
Dear All,
good afternoon:
i am facing problem with oracle 6i connecting to oracle RAC two nodes cluster. which was working fine from last 3-4 years and there was no issue with application as well as database.
now i am getting error with oracle 6i forms , sometimg its not connecting with database . when i enabled the trace on 6i sqlnet.ora file.
i goted the result
trace file:
-- TRACE CONFIGURATION INFORMATION FOLLOWS ---
New trace stream is "C:\ora6i\NET80\ADMIN\trace\conection.trc.trc"
New trace level is 16
--- TRACE CONFIGURATION INFORMATION ENDS ---
[02-MAY-10 12:33:07] nigini: entry
[02-MAY-10 12:33:07] nigini: Count in NI global area now: 1
[02-MAY-10 12:33:07] nigini: Count in NI global area now: 1
[02-MAY-10 12:33:07] nrigbi: entry
[02-MAY-10 12:33:07] nrigbni: entry
[02-MAY-10 12:33:07] nrigbni: Unable to get data from navigation file tnsnav.ora
[02-MAY-10 12:33:07] nrigbni: exit
[02-MAY-10 12:33:07] nrigbi: exit
[02-MAY-10 12:33:07] nigini: exit
[02-MAY-10 12:33:07] niqname: Using nnfsn2a() to build connect descriptor for (possibly remote) database.
[02-MAY-10 12:33:07] nnftboot: entry
[02-MAY-10 12:33:07] nnftboot: exit
[02-MAY-10 12:33:07] nnfoboot: entry
[02-MAY-10 12:33:07] nnfoboot: exit
[02-MAY-10 12:33:07] nnfoboot: entry
[02-MAY-10 12:33:07] nnfoboot: exit
[02-MAY-10 12:33:07] nnfhboot: entry
[02-MAY-10 12:33:07] nnfhboot: exit
[02-MAY-10 12:33:07] nncpmlf_make_local_addrfile: construction of local names file failed
[02-MAY-10 12:33:07] nncpmsf_make_sys_addrfile: system names file is C:\ora6i\NET80\admin\tnsnames.ora
[02-MAY-10 12:33:07] nncpcin_maybe_init: first request sent to name server will have ID 0
[02-MAY-10 12:33:07] nncpcin_maybe_init: initial retry timeout for all name servers is 1500 csecs
[02-MAY-10 12:33:07] nncpcin_maybe_init: max request retries per name server is 1
[02-MAY-10 12:33:07] nngsini_init_streams: initializing stream subsystem, cache size is 10
[02-MAY-10 12:33:07] nngtini_init_msg: initializing PDU subsystem, initial pool size is 2
[02-MAY-10 12:33:07] nncpcin_maybe_init: default name server domain is [root]
[02-MAY-10 12:33:07] nnfun2a: entry
[02-MAY-10 12:33:07] nnftqnm: entry
[02-MAY-10 12:33:07] nnfcagmd: entry
[02-MAY-10 12:33:07] nnfcagmd: Attempting to find metadata for type a.smd
[02-MAY-10 12:33:07] nnfcagmd: Attribute name a.smd is a predefined meta type, syntax is 4.
[02-MAY-10 12:33:07] nnfcagmd: exit
[02-MAY-10 12:33:07] nnfotran: Checking local tnsnames.ora file
[02-MAY-10 12:33:07] nnfotran: Checking local tnsnames.ora file
[02-MAY-10 12:33:07] nncpldf_load_addrfile: initial load of names file C:\ora6i\NET80\admin\tnsnames.ora
[02-MAY-10 12:33:07] nncpldf_load_addrfile: failure, error stack follows
[02-MAY-10 12:33:07] nncpldf_load_addrfile: NL-00425: bad continuation line
NL-00425: bad continuation line
NL-00425: bad continuation line
NL-00425: bad continuation line
[02-MAY-10 12:33:07] nncpldf_load_addrfile: NOTE: FILE CONTAINS ERRORS, SOME NAMES MAY BE MISSING
[02-MAY-10 12:33:07] nnftqnm: Using tnsnames.ora address (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = dbsr15-vip1.dxbdom08.com)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = dbsr15-vip2.dxbdom08.com)(PORT = 1521)) (LOAD_BALANCE = yes) (FAILOVER = ON) (CONNECT_DATA = (SERVICE_NAME = mscdxb)(SERVER=DEDICATED) (FAILOVER_MODE=(TYPE=select)(METHOD=basic)))) for name mscdxb
[02-MAY-10 12:33:07] nnfcraa: entry
[02-MAY-10 12:33:07] nnfun2a: Obtaining answer records for mscdxb
[02-MAY-10 12:33:07] nnftans: entry
[02-MAY-10 12:33:07] nnfcran: entry
[02-MAY-10 12:33:07] nnfcran: 64 rrs requested, 1 remaining, 1 total
[02-MAY-10 12:33:07] nnfcran: exit
[02-MAY-10 12:33:07] nnfotrv1: entry
[02-MAY-10 12:33:07] nnfotrv1: translated "mscdxb" to (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = dbsr15-vip1.dxbdom08.com)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = dbsr15-vip2.dxbdom08.com)(PORT = 1521)) (LOAD_BALANCE = yes) (FAILOVER = ON) (CONNECT_DATA = (SERVICE_NAME = mscdxb)(SERVER=DEDICATED) (FAILOVER_MODE=(TYPE=select)(METHOD=basic))))
[02-MAY-10 12:33:07] nngsdei_deinit_streams: deinit
[02-MAY-10 12:33:07] nngscls_close_stream: UID 0 not established, ignored
[02-MAY-10 12:33:07] nngscls_close_stream: UID 0 not established, ignored
[02-MAY-10 12:33:07] nngscls_close_stream: UID 0 not established, ignored
[02-MAY-10 12:33:07] nngscls_close_stream: UID 0 not established, ignored
[02-MAY-10 12:33:07] nngscls_close_stream: UID 0 not established, ignored
[02-MAY-10 12:33:07] nngscls_close_stream: UID 0 not established, ignored
[02-MAY-10 12:33:07] nngscls_close_stream: UID 0 not established, ignored
[02-MAY-10 12:33:07] nngscls_close_stream: UID 0 not established, ignored
[02-MAY-10 12:33:07] nngscls_close_stream: UID 0 not established, ignored
[02-MAY-10 12:33:07] nngscls_close_stream: UID 0 not established, ignored
please help me,
thanks in advance.
sher khanthanks dear this is my tnsfile please check it. if any error can you corect me.
mscdxb =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.2)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.3)(PORT = 1521))
(LOAD_BALANCE = on)
(FAILOVER = ON)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = mscdxb)
(FAILOVER_MODE=
(TYPE=select)
(METHOD=basic))
thanks,
sher khan -
Problem in Oracle Database Connectivity in JSP
I am having big problem such as Oracle Database connectivity problem
Following code i am used for database connection. but it throw an exception call class not found exception.
Pls any one can help me. With a sample code for Oracle Database connection in JSP
Class.forName ("oracle.jdbc.driver.OracleDriver");
String url="jdbc:oracle:thin:@172.25.44.54:1521:bbo";
con = DriverManager.getConnection(url,"user", "user123");
Thank youWell i've never used oracle or their drivers before but i'm presuming that you'd go to oracle.com or something and look for downloads. Otherwise you could goodle for Oracle JDBC drivers. Then just follow the instructions.
Again i've never used JSP but if you have a manifest file somewhere you'll need to put a class-path: entry in their referecning the jar file with the driver so that it is availble at run-time.
Wes -
Experts,
Do we have any automated tool that will detect joins in the layers ???
secondly in case we start with manually joining the tables will there be any join problems like we have in BO?
Third In case of manual joins in physical layer can have to make joins that suit our requirement or we have to follow the database structure. and join all columns that could be joined in the structure
thanks in advance
Edited by: ZSAMEE on May 2, 2011 11:55 AM
Edited by: ZSAMEE on May 2, 2011 12:11 PMAs far as I know there are no tools out there that would automatically join the tables in BMM layer. You have to join the fact and dimensions to design star/snow flake schema's manually.
Thanks,
-Amith. -
Business Rules:Non-oracle db connections not shown in the ADF-BC Facts sect
Hi everyone
I'm working with Oracle BPM 11.1.1.5.0
JDeverloper: 11.1.1.5.0
Database : SQL Server 2008.
I'm trying to create some rules based on some value in my tables in the database.
The problem:
My non-oracle DB connections are not shown in my Business rule, in the ADF-BC Facts section on the Facts tab.
I have two oracle db connections and one SQL Server connection, and all three have been working perfectly before.
But in the business rules facts section, when I want to add a new ADF-BC fact, only the oracle connections are shown.
I have tried recreating all of them a few times, re registering my sqljdbc jar file, creating a new test application from scratch, but none seems to work.
Can some one give me any hint please?
Thanks in advancehas anyone else had this problem ?
-
Sybase oracle heterogeneous connection
Hi all,
I created a connection from oracle to sybase using oracle heterogeneous connection. However I have a problem with numeric characters, I cannot get floating parts of numbers.
when I use create as syntax it maps to correct data types(with the correct precision and scale) but 12,49 comes like 12,00.
My Database is 10.2.0.3.0 32bit windows
Any help would be appreciated..The problem was because of language settings. Setting NLS_LANG in the registery to correct setting solved the problem..
-
Outer join problem (ORA-01799)
We have a database design roughly as follows:
- A STAFF table (columns don't matter here).
- Resources have a cost per hour that varies over time, so we have a STAFF_COST table with an effective date and a cost per hour
- A PROJECT table (columns don't matter here).
- Projects can have staff assigned, so we have a PROJECT_STAFF table which has foreign keys to the PROJECT and STAFF table.
- Project staff have a cost per hour, which can vary over time, and be different to the (default) staff costs. So we have a PROJECT_STAFF_COST table which uses the PROJECT_STAFF foreign key, with an effective date and a cost per hour
- Staff work on tasks so we have a TIMESHEET_TASK and TIMESHEET_DAY tables which define a project worked on, task within the project (optional as time can be 'entered against the project', who is recording the time, the hours worked and the day the hours were worked.
So when timesheet information is entered we have three scenario's that we need to cover.
1) The resource is a member of the project and the hours were worked on a day for which we have a project staff cost. That is, the project staff cost table has one or more rows for the staff member assigned to the given project with an effective date before the date the hours were entered against.
2) The resource is a member of the project but the hours were worked on a day for which we do not have a project staff cost. That is, the project staff cost table has one or more entries for the staff member assigned to the given project, but all the effective dates are after the date the hours were entered against.
3) The resource is not a member of the project. That is, the project staff cost table does not have any rows for the staff member. Time was entered 'against the project'.
We need to work out the actual cost of the project. So we need to retrieve every day's timesheet entry, returning the hours assigned and the cost per hour relevant for that day. I have the following query:
select tsh.staff_id, s.full_name, tsd.entry_date, tsd.hours as ProjectHours,
psCOST_INFO.cost_per_hour as ProjectCost
from timesheet_day tsd
inner join timesheet_task tst on tst.timesheet_task_id = tsd.timesheet_task_id
inner join timesheet_header tsh on tst.timesheet_header_id = tsh.timesheet_header_id
inner join staff s on s.staff_id = tsh.staff_id
left join (Select ps.project_id, ps.staff_id, psc.project_staff_id, psc.effective_date, psc.cost_per_hour
from project_staff ps
inner join project_staff_cost psc on ps.project_staff_id = psc.project_staff_id) as psCOST_INFO
on psCOST_INFO.staff_id = tsh.staff_id and psCOST_INFO.project_id = tst.project_id
and psCOST_INFO.effective_date = (select max(ps2.effective_date) from project_staff_cost ps2
where ps2.project_staff_id = psCOST_INFO.project_staff_id
and ps2.effective_date <= tsd.entry_date)
where tst.project_id = 55825
Using the left join covers scenario's 2 and 3 above because I will get null in the cost columns and can then take appropriate action. If I were to use an inner join, then hours in timesheets from scenario's 2 and 3 would be excluded, which is not what we want.
The subselect using the MAX aggregate function is required to get the cost per hour most relevant for the timesheet day. That is, if there are several effective dates for the project staff member before the date in question, we want the most recent one. We can't just use the MAX one, however in case there is an effective date after the particular timesheet date. Sheesh...
This query works fine in SQL Server. It it not allowed in Oracle and returns an ORA-01799 column may not be outer joined to a subquery.
I'm not going to bother to ask why not. I just need a way to do what I want. I've spent days trying to move the code around but I either end up with an inner join (which returns fewer rows than I want) or it just plain don't work.
Can someone help me rework this query to achieve the result I want?
Thanks, AndrewThanks for your reply, Laurent. In my experience trying to cut important corners in explaining a problem only serves to make it more difficult to solve. That pretty much was the smallest reproducable query that demonstrates the complexity of the problem I have. I'm not just trying to get which publishers live in the 'CA' state here...
From what I have just read about rank() it serves the same purpose as max() on a given column, and getting the maximum or top ranked one just doesn't cut it. As I said in my original post that provided all the relevant (and no spurious) information on the problem, it is possible that there are effective dates AFTER the date we are interested in and they have to be excluded.
I have to get the project staff cost row with the latest date that is before the timesheet date. That means I have to reference data in the outer query. Oracle seems to have a problem with that when used in an outer join.
We are currently going down the track of 3 UNION'd statement to cover the 3 scenario's. A single query would be more efficient so if anyone can provide guidance I would appreciate it.
Thanks, Andrew -
Entity Framework - unable to select the oracle data connection
Entity Framework - unable to select the oracle data connection from the wizard that allows you to select the data provider. Even though we successfully added a data connection that points to an oracle database, we still can't select an existing data connection or create a new database provider that points to an oracle instance.
we are using both vs 2008 sp1 and vs 2010. We connect to oracle 11g and we use the latest oracle odp.net driver. the Driver is installed and working in vs studio.I had this exact problem when I started. I think I had downloaded the wrong odbc (the 64x version). When I unloaded that version and downloaded the 32bit version it worked.
Hope that helps. ~ Darla -
1.5.4 - Slow to expand tables node for a oracle 9 connection
Hi
I have been trying out version 1.5.4 and have found that expanding the tables node on the connections tab is extremely slow (approx 3 min) for my oracle 9.2.0.6 connections.
As with this [this bug |http://forums.oracle.com/forums/thread.jspa?threadID=867600&tstart=0] it is ok on a 10.2.0.3 connection.
Expanding the tables node for the same connection in 1.5.3 is also fine. I'm abit concerned that this latest version of sql dev has not been tested particularly thoroughly with oracle 9.
Is oracle 9 still a supported version with sql developer?
thanks
paulIt's not just Oracle 9 that is having problems with the table node. I am connecting to a 10.2.0.3 DB (basic connection) using JDK 1.6.0_06 and filtering for a single table (using = and case sensitive). On 1.5.4 this takes 25 seconds but on 1.5.3 this only takes 2 seconds. However, without a filter, the 1.5.4 performance is significantly better than the 1.5.3 performance without a filter.
The queries SQL Developer uses certainly have been changed between 1.5.3 and 1.5.4.
1.5.3 query:select * from (
SELECT o.OBJECT_NAME, o.OBJECT_ID ,'' short_name, t.partitioned,t.iot_type, o.OWNER OBJECT_OWNER, o.CREATED, o.LAST_DDL_TIME
FROM SYS.ALL_OBJECTS O ,sys.all_tables t
WHERE O.OWNER = :SCHEMA
and o.owner = t.owner(+)
and o.object_name = t.table_name(+)
AND O.OBJECT_TYPE = 'TABLE'
AND O.GENERATED = 'N'
AND O.OBJECT_NAME NOT IN ( SELECT OBJECT_NAME FROM RECYCLEBIN )
AND NOT EXISTS (SELECT 1 FROM SYS.ALL_MVIEWS WHERE MVIEW_NAME = O.OBJECT_NAME AND OWNER = O.OWNER)
AND NOT EXISTS (SELECT 1 from all_queue_tables WHERE QUEUE_TABLE = O.OBJECT_NAME AND OWNER = O.OWNER)
AND not ( object_name like 'AQ$_%_G'
or object_name like 'AQ$_%_H'
or object_name like 'AQ$_%_I'
or object_name like 'AQ$_%_S'
or object_name like 'AQ$_%_T' )
union all
SELECT OBJECT_NAME, OBJECT_ID , syn.SYNONYM_NAME short_NAME,
t.partitioned,t.iot_type, SYN.TABLE_OWNER OBJECT_OWNER, o.CREATED, o.LAST_DDL_TIME
FROM SYS.ALL_OBJECTS O, sys.user_synonyms syn,sys.all_tables t
WHERE syn.table_owner = o.owner
and syn.TABLE_NAME = o.object_NAME
and o.object_name = t.table_name
and o.owner = t.owner
and o.object_type = 'TABLE'
and :INCLUDE_SYNS = 1
and :SCHEMA = USER
AND O.GENERATED = 'N'
AND O.OBJECT_NAME NOT IN ( SELECT OBJECT_NAME FROM RECYCLEBIN)
WHERE OBJECT_NAME = :OBJECT_NAME1.5.4 query:with tabs as (
select t.*, rownum rn -- not merge
from sys.all_tables t
where owner = :SCHEMA
), objs as (
select o.*, rownum rn -- not merge
from sys.all_objects o
where owner = :SCHEMA
AND O.OBJECT_TYPE = 'TABLE'
AND O.GENERATED = 'N'
AND O.OBJECT_NAME NOT IN (SELECT OBJECT_NAME FROM RECYCLEBIN)
AND O.OBJECT_NAME NOT IN (SELECT MVIEW_NAME FROM SYS.ALL_MVIEWS WHERE :SCHEMA = OWNER)
AND O.OBJECT_NAME NOT IN (SELECT QUEUE_TABLE from all_queue_tables WHERE :SCHEMA = OWNER)
AND not ( object_name like 'AQ$_%_G'
or object_name like 'AQ$_%_H'
or object_name like 'AQ$_%_I'
or object_name like 'AQ$_%_S'
or object_name like 'AQ$_%_T' )
AND ( user = :SCHEMA or not object_name like 'BIN$%' ) -- user != :SCHEMA --> object_name not like 'BIN$%'
-- RECYCLEBIN is USER_RECYCLEBIN!
) select * from (
SELECT o.OBJECT_NAME, o.OBJECT_ID ,'' short_name, t.partitioned,t.iot_type, o.OWNER OBJECT_OWNER, o.CREATED, o.LAST_DDL_TIME
FROM OBJS O , tabs t
WHERE o.object_name = t.table_name
union all
SELECT OBJECT_NAME, OBJECT_ID , syn.SYNONYM_NAME short_NAME,
t.partitioned,t.iot_type, SYN.TABLE_OWNER OBJECT_OWNER, o.CREATED, o.LAST_DDL_TIME
FROM sys.all_objects O, sys.user_synonyms syn,sys.all_tables t
WHERE syn.table_owner = o.owner
and syn.TABLE_NAME = o.object_NAME
and o.object_name = t.table_name
and :INCLUDE_SYNS = 1
and :SCHEMA = USER
WHERE OBJECT_NAME = :OBJECT_NAMEtheFurryOne -
Multiple joins Problem in Physical Layer.
I have two tables Departments and Employees in the physical layer of admin tool. When i am trying
to create foreign keys at physical diagram its giving error.
Scenario:
Departments
===========
Department_id (PK)
Manager_id (FK)
Employees
========
Employee_id (PK)
Department_id (FK)
Manager_id (FK)
1. Manager_id of Departments table references Employee_id of Employees table
2. Department_id of Employees table references Department_id of Departments table.
3. Manager_id of Employees table references Employee_id of Employees table.
I have done 1st one. After 2nd one i have tested for consistency check, the following error is coming:
[38015] Physical tables "Oracle DB Connection".."HR"."EMPLOYEES" and "Oracle DB Connection".."HR"."DEPARTMENTS" have multiple joins.
Delete new foreign key object if it is a duplicate of existing foreign key.
How to solve this?
How to do 3rd one also?
Please clarify.
regards
chandra kanth
Edited by: Chandra kanth on 08-Dec-2011 01:47Hi,
I have created two alias tables (E1 Employees, D1 Departments) for Employees, Departments tables.
I have created foreign key joins as follows:
D1 Departments:
EMPLOYEES.EMPLOYEE_ID = "D1 DEPARTMENTS".MANAGER_ID
E1 Employees:
EMPLOYEES.EMPLOYEE_ID = "E1 EMPLOYEES".MANAGER_ID
and it is consistent also. Please let me know whether the above approach is right or not.
regards
chandra kanth. -
Oracle 10 Connection Cache (another question)
Hi all,
We have a large web app which currently uses JRun connection pooling. This is causing some problems so we'd like to try the Oracle Connection Cache mechanism. The thing is, each time a client gets a database connection, it runs a connection factory which looks up the datasource with jndi then creates the connection. So, in order for the Oracle 10 Connection Cache to work, do I need to change the logic so the datasource is static & we just do the look up once & set the cache-related properties at that point so every connection uses the same datasource object? This seems to me the way to go.
Thanks very much,
Jim GreethamPerfectly Yes. If we try using Oracle's own Cahceing mechanism, it is out of our control. But if we custom deploy our own cacheing mechanism according to our need like you said, we need to develop our own codes using ojdbc6 driver available from Oracle.
-
Oracle DB Connect Date Selection
Hi All,
I have managed to extract from Oracle db connecting through DB connect, I'm currently having the problem of limiting my extraction using the date data selection.
I have declared the date to be numc 10, and when the data is extracted over my date will appear as 1-AUG-07, which is still ok as I can transform into SAP format. However, I would like to limit my data by a Date selection, but any format i enter it will return an error.
May I know how i could do a date selection?
ThanksHi,
you have to convert your oracle date.
eg.
SELECT TO_CHAR(CURRENT_DATE, 'YYYYMMDD') FROM DUAL
will give you 20070511.
hope this helps...
Olivier. -
Communicating with xstring to Oracle Inter Connect
Hello,
We're using Oracle Inter Connect to communicate between SAP and other applications. To do so, we build remote enabled function modules.
We now have the problem that Inter Connect does not find RFC's which have parameters which are reffered as TYPE (fe i_matnr type matnr).
We want to use the xstring as importing and exporting parameter, but we can not refer to it as LIKE (fe i_matnr like mara-matnr).
Does anyone have expirience with this problem or has a solution?
Regards,
JohnNo suggestions?
-
OID Replication - Unable to test Oracle Net connections to a node with SQL
Hi all,
I am implementing OID replication and currently stuck on the verification part where I should use SQL*Plus to verify if TNSNAMES.ORA is configured correctly.
First server installed as a regular OID installation. Second server is installed with a high availability option.
Server1: name: server. Domain: domain.com
Server2: name: oid1. Domain: galaxy.com
My TSNAMES.ORA:
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = server.domain.com)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = orcl)
OIDREP =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = oid1.galaxy.com)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = orcl)
So, the configuration instructions state to test both WITH and WITHOUT the domain name:
IMPORTANT: Test Oracle Net connections to all nodes from each node in the DRG.
Use SQL*Plus. Test both system@net_service_name and system@net_service_name.domain.
IF THIS DOES NOT WORK, THEN ASR REPLICATION SETUP WILL NOT BE SUCCESSFUL!
So, my SQL*Plus statement "*sqlplus "sys/abcd1234@orcl as sysdba"* works just fine.
But the command "*sqlplus "sys/[email protected] as sysdba"* fails with ORA-12154: TNS:could not resolve the connect identifier specified
Thanks in advance for your input.Vijay,
Thank you for your help. I was able to connect to my first instance without any issues. My next problem is updating TSNAMES with the second server, I am still getting the error message when connecting via SQLPLUS. May be my SQL statement wrong?
sqlplus sys/[email protected] as sysdba" or sqlplus sys/abcd1234@OIDREP as sysdba Neither one is working :(
Here is my TSNAMES. For now, I am using IP addresses
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.192.141)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = orcl)
ORCL.DOMAIN.COM =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.192.141)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = orcl)
OIDREP =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.192.137)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = orcl)
OIDREP.GALAXY.COM =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.192.137)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = orcl)
-----
Maybe you are looking for
-
ITunes on XP PC won't recognize iTunes Library from Macbook or PC Laptop
I have 3 computers on my network. The main PC is a desktop running XP, and I have 2 laptops; a Gateway PC running Vista and a 15" Macbook Pro running OS X. With all 3 machines powered on and iTunes open in all of them, the desktop PC no longer recogn
-
No audio for some files in the Final Cut Event/Original Media folder
Hi, recently, I noticed that some of the video files stored into the Final Cut Event/"Event"/Original Media folder had no audio. They do have audio when I read them into FCP X but not when I open them as ordinary files in the Finder. It worries me as
-
My apple TV automatically updated and now that the update is done, I get a screen with the back of the Apple TV showing a plug coming out of the HDMI spot pointing toward a music sign. How do I get the menu screen back?
-
BO XI R2 to BO XI 3.1 upgrade - Best Practice
Hi Experts, We are using BO Xi R2 version now. We would like to upgrade BO XI R2 to BO XI R3.1 version. Could you please suggest me How to do that. Could you please provide me step by step how to go about this task? Could you please tell me w
-
I downloaded the Oracle9i, i cant login the SQL server , so i need the user name, password and the host string !!!! also i want to know which file in Oracle contains the service names so i can add my own service name !!!!!! Jehad