CONNECT BY giving different results / duplicate records
I have a hierarchy like this:
UserTable-> username, treename_code
username treename_code
Scott TREE
Henry TREE
TREENAMES-> treename_code
treename_code
TREE
subtree-> id, parent_id, treename_code
ID parent_id treename_code
1 null TREE
2 1 TREE
select case when connect_by_isleaf = 1 then 0 when level = 1 then 1 else -1 end as status, level, subtree.id as value, SYS_CONNECT_BY_PATH(subtree.id, '/') Path from usertable, treenames, subtree where upper(usertable.username)=upper(:username) and treenames.treename_code=usertable.treename_code and subtree.treename_code=treenames.treename_code start with subtree.parent_id is null connect by subtree.parent_id=prior subtree.id;
Database version: 11.2.0.1.0
According to the user, the order of results is different: we give values:
1-2-2 (double on '2')
gives another
2 1-2 (always double on '2')
BUT on another database, same version, it gives:
1-2 (which is expected)
Any idea?
This is essentially because of the what the predicate to filter for the USER name is applied. If you are using an Inline view, you will get the desired result.
Check this. I just simplified your query by removing just the other columns in the select list. But the CONNECT BY and are of the join of the table intact.
SQL > select subtree.id
2 usertable,
3 treenames,
subtree 4
5 where upper (usertable.username) = upper ('scott')
6 and treenames.treename_code = usertable.treename_code
7 and subtree.treename_code = treenames.treename_code
8 start
9 with subtree.parent_id is null
10 connect
11 by prior subtree.id = subtree.parent_id;
ID
----------
2
1
2
SQL > select * from table (dbms_xplan.display_cursor);
PLAN_TABLE_OUTPUT
-------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
| ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |
----------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 7 (100) | |
|* 1 | FILTER | | | | | |
|* 2 | CONNECT BY WITH FILTERING | | | | | |
|* 3 | HASH JOIN | | 2. 102. 7 (15) | 00:00:01 |
| 4. THE CARTESIAN MERGE JOIN. | 2. 90. 4 (0) | 00:00:01 |
|* 5 | TABLE ACCESS FULL | SUBTREE. 1. 32. 2 (0) | 00:00:01 |
| 8 2 SORT OF BUFFER. | 2. 26. 2 (0) | 00:00:01 |
| 7. TABLE ACCESS FULL | USERTABLE | 2. 26. 2 (0) | 00:00:01 |
| 3 × TABLE ACCESS FULL | TREENAMES | 1. 8-2-2 (0) | 00:00:01 |
|* 9 | HASH JOIN | | 1. 51. 7 (15) | 00:00:01 |
| 10. THE CARTESIAN MERGE JOIN. | 1. 45. 4 (0) | 00:00:01 |
| * 11 | HASH JOIN | | | | | |
| 12. CONNECT PUMP | | | | | |
| 13. TABLE ACCESS FULL | SUBTREE. 1. 32. 2 (0) | 00:00:01 |
| 14. KIND OF BUFFER. | 2. 26. 2 (0) | 00:00:01 |
| 15. TABLE ACCESS FULL | USERTABLE | 2. 26. 2 (0) | 00:00:01 |
| 16. TABLE ACCESS FULL | TREENAMES | 1. 6. 2 (0) | 00:00:01 |
----------------------------------------------------------------------------------------
Information of predicates (identified by the operation identity card):
---------------------------------------------------
1 Filter (SUPERIOR ("USERTABLE".) "USER NAME") = "SCOTT") "
2 - access("SUBTREE".") PARENT_ID "= NULL PREREQUISITE)
3 - access("TREENAMES".") TREENAME_CODE '=' USERTABLE '. "" TREENAME_CODE "AND
"SUBTREE". "" TREENAME_CODE "=" TREENAMES. " ("' TREENAME_CODE")
5 - filter("SUBTREE".") (PARENT_ID' IS NULL)
9 - access("TREENAMES".") TREENAME_CODE '=' USERTABLE '. "" TREENAME_CODE "AND
"SUBTREE". "" TREENAME_CODE "=" TREENAMES. " ("' TREENAME_CODE")
11 - access("SUBTREE".") PARENT_ID "= NULL PREREQUISITE)
If you see that the filter for the USER name is applied after that CONNECT BY runs. But if I use a view online. then check it
SQL > select id
2 starting at)
3. Select subtree.id
4, subtree.parent_id
5 usertable,
6 treenames,
subtree 7
8 where upper (usertable.username) = upper ('scott')
9 and treenames.treename_code = usertable.treename_code
10 and subtree.treename_code = treenames.treename_code
11 )
Starter 12
13 with parent_id is null
14 connect
15 by parent_id = prior id;
ID
----------
1
2
SQL > select * from table (dbms_xplan.display_cursor);
PLAN_TABLE_OUTPUT
-------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------
| ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |
---------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 7 (100) | |
|* 1 | CONNECT BY WITH FILTERING | | | | | |
|* 2 | HASH JOIN | | 1. 51. 7 (15) | 00:00:01 |
| 3. THE CARTESIAN MERGE JOIN. | 1. 45. 4 (0) | 00:00:01 |
|* 4 | TABLE ACCESS FULL | USERTABLE | 1. 13. 2 (0) | 00:00:01 |
| 5. KIND OF BUFFER. | 1. 32. 2 (0) | 00:00:01 |
|* 6 | TABLE ACCESS FULL | SUBTREE. 1. 32. 2 (0) | 00:00:01 |
| 7. TABLE ACCESS FULL | TREENAMES | 1. 6. 2 (0) | 00:00:01 |
|* 8 | HASH JOIN | | 1. 51. 7 (15) | 00:00:01 |
| 9. THE CARTESIAN MERGE JOIN. | 1. 45. 4 (0) | 00:00:01 |
| * 10 | HASH JOIN | | | | | |
| 11. CONNECT PUMP | | | | | |
| 12. TABLE ACCESS FULL | SUBTREE. 1. 32. 2 (0) | 00:00:01 |
| 13. KIND OF BUFFER. | 1. 13. 2 (0) | 00:00:01 |
| * 14 | TABLE ACCESS FULL | USERTABLE | 1. 13. 2 (0) | 00:00:01 |
| 15. TABLE ACCESS FULL | TREENAMES | 1. 6. 2 (0) | 00:00:01 |
---------------------------------------------------------------------------------------
Information of predicates (identified by the operation identity card):
---------------------------------------------------
1 - access("SUBTREE".") PARENT_ID "= NULL PREREQUISITE)
2 - access("TREENAMES".") TREENAME_CODE '=' USERTABLE '. "" TREENAME_CODE "AND
"SUBTREE". "" TREENAME_CODE "=" TREENAMES. " ("' TREENAME_CODE")
4 filter (SUPERIOR ("USERTABLE".) "USER NAME") = "SCOTT") "
6 - filter("SUBTREE".") (PARENT_ID' IS NULL)
8 - access("TREENAMES".") TREENAME_CODE '=' USERTABLE '. "" TREENAME_CODE "AND
"SUBTREE". "" TREENAME_CODE "=" TREENAMES. " ("' TREENAME_CODE")
10 - access("SUBTREE".") PARENT_ID "= NULL PREREQUISITE)
14 filter (SUPERIOR ("USERTABLE".) "USER NAME") = "SCOTT") "
Here, the filter is applied before CONNECT you IS executed. This is the reason why you get the unexpected result in your query. Use the online mode.
Tags: Database
Similar Questions
-
Internal CDT generator giving different results of compilation on successive attempts of compilation
Hello, I'm new to developing for BlackBerry 10 and I was wondering if someone could help me with this problem. A little background first - I am trying to transfer an existing BB10 iOS app, the source is all written in C/C++ so I use the native SDK 10.0.9.1673. I use the IDE on a Mac (OSX 10.8.2).
I've set up a project GLES2.0 skeleton by using the 'new blackberry project' Assistant and have linked folders that contain the source and header files (by using the project properties-> C/C++-> component paths of access and symbols General and location tabs includes / Source). The source files and header are all in separate files in the same directory level as the project (because of the way our structure of project works) file, although I believe that this should make a difference.
Of course, at this point, I don't expect the project to compile properly, but my problem is that whenever I try to compile the project, it seems to compile another group of files, with the result that I get a different error whenever I try to compile, even when I have not changed the code. I guess this isn't normal behavior, as it makes it very difficult to identify and solve problems. Does anyone have any suggestions as to what could be the problem? I wonder if I need to specify some settings or something like that?
A final bit of information, I get warnings directive #import (which is used in a number of places in the version of iOS) is obsolete. I don't know if it's related or not - although if it is I don't know what can be done beyond big passage to using #includes all over the place?
Thanks in advance for any help that anyone can give,
Just to doublecheck - you put all your src file right?
If you have too many mistakes and too many files, then it is normal to get different error/files each time. Just start correct and gradually you will get the same set of errors-)
Okay, I don't know if that's normal or not normal, but I took it as is (I hit the same problem, great project to port).
-
SimpleDateFormat giving different results for the same string in the form
I use http://www.blackberry.com/developers/docs/7.1.0api/net/rim/device/api/i18n/SimpleDateFormat.html for formatting my date and time fields.
I got a bug report that a device on English (UK) has a problem where the time turns off the screen, and I was able to reproduce this on device and Simulator.
It's the pattern string that I use: hh:mma
(hour 2 digits, colon, minute 2-digit and one letter for 'a' or 'p')
English or r I get the result you want, for example 12: 12 p '
"On English (UK), I get two letters for one / p marker, for example ' 12:12.
(as if I had used 'hh:mmaa').
What is the desired behavior? My client doesn't like it and wants a look and feel unique, with only one letter for 'a' or 'p', and I'm a little hesitatant to use aubstring...
I usually do so, but our customer asked specifically localized to the date and time formatting.
I have the model in my resource files, as the requested values are not easy to manage with the dateformat standard.Well, I have submitted comments on the entry of doc API, the doc is fake or the OS has a bug.
I use substring if the string endsWith (am or pm) now... -
Connect Reporting different results to look at a pdf file
Through a program of training and receipt, a team of users is necessary to read a pdf file, close it, and then recognize their agreement with the terms in the pdf file. In order to show completed in the curriculum, all courses must be completed. The pdf is set up as a course and need to show as completed. I see the results of different people who consult this pdf file. Some users show over some not taken when they say they have opened the pdf file and found that it. This is a 2 page document. Of the reasons why we would get such different results? To get a complete users should consult the two pages? Other suggestions?
When I see this problem, it usually has to do with the conversion of the PDF file to allow the display of reports. Either re - download the PDF file and update the price or convert the document to HTML and use this current version. PDF conversion is random and frequent, but will allow some users to obtain a full and some show status does not matter how much the view the PDF.
-
Hi gurus of the Oracle,.
Good morning/afternoon/evening!
There are several methods to effectively identify duplicate records. e.g. row_number() and group by, but all of these methods to highlight the duplicate record only. Which means that if your table has data such as
ID Name Room Date 1 ABC 203 20/07/2015 2 FGH 109 20/09/2015 3 HSF 202 20/08/2015 4 REF 201 20/08/2015 5 FGH 109 20/09/2015 6 HSF 291 24/08/2015 And I want to find duplicates based on name/room/day
Most of the queries will give me
Or the other
ID Name Room Date 5 FGH 109 20/09/2015 or
ID Name Room Date 2 FGH 109 20/09/2015
They don't give me two files unless I first do a group by (or Row_Number) in an internal query and then try to get the two lines in the outer query. In my view, should not be the way.
I need a report which highlights the two records only
ID Name Room Date 2 FGH 109 20/09/2015 5 FGH 109 20/09/2015 Hope that is clear.
Thanks in advance!
Hello
34MCA2K2 wrote:
Hi gurus of the Oracle,.
Good morning/afternoon/evening!
There are several methods to effectively identify duplicate records. e.g. row_number() and however all these methods to highlight only the duplicate of group by. Which means that if your table has data such as
ID Name Room Date 1 ABC 203 20/07/2015 2 FGH 109 20/09/2015 3 HSF 202 20/08/2015 4 REF 201 20/08/2015 5 FGH 109 20/09/2015 6 HSF 291 24/08/2015 And I want to find duplicates based on name/room/day
Most of the queries will give me
Or the other
ID Name Room Date 5 FGH 109 20/09/2015 or
ID Name Room Date 2 FGH 109 20/09/2015
They don't give me two files unless I first do a group by (or Row_Number) in an internal query and then try to get the two lines in the outer query. In my view, that shouldn't be the way...
Help the ROW_NUMBER analytic function, that you described is probably the easiest and most effective way to get the desired results.
You can do it without using any kind of subquery (for example, with a self-join or CONNECT BY), but which requires SELECT DISTINCT, which is inefficient.
-
original title: a different output for ping - an IP address
I am trying to determine the name of the computer to an IP address
When I open a command prompt in a computer (Windows XP connected to our domain) and type ping - a [IP address], I get a result
When I open a command prompt in another computer (Windows Server 2008 connected to the WORKING group) and type ping - a [IP address], I get a different result
And there are other times when ping - [IP address] will display the name of the computer on a computer (usually the Windows Server 2008), but not the other
I tried to google
1. why this happens
2. what result is correct
Please specify.
The order of DNS in Windows name resolution is as follows:
- Name of the local host (file Hosts Local generally in c:\windows\system32\drivers\etc\hosts)
- Cache Client DNS resolution
- DNS server
- Cache of NetBIOS names
- WINS server
- NetBIOS broadcasts
- File LMHosts (same location as the HOSTS file)
The reason you get different results could be because machines could be on different subnets (different results for broadcast), using a different DNS server machines or are configured for different WINS servers, or the names are already cached because of prior activity.
HTH,
JW -
Matching records between 2 tables with duplicate records
Hi all
I need help in what follows.
I have 2 tables Received_bills and Send_bills.
-------------------------------------------------------
-The DOF for Table SEND_BILLS
--------------------------------------------------------
CREATE TABLE SEND_BILLS
(DATE OF "DATUM",
NUMBER OF "PAYMENT."
'CODE' VARCHAR2 (5 BYTE)
) ;
--------------------------------------------------------
-The DOF for Table RECEIVED_BILLS
--------------------------------------------------------
CREATE TABLE 'RECEIVED_BILLS '.
(DATE OF "DATUM",
NUMBER OF "PAYMENT."
'CODE' VARCHAR2 (5 BYTE),
VARCHAR2 (5 BYTE) 'STATUS' ) ;
INSERTION of REM in RECEIVED_BILLS
TOGETHER TO DEFINE
Insert. RECEIVED_BILLS (DATUM, PAYMENT, CODE, STATE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1', 'SUCCESS');
Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 'A5', 'SUCCESS', 25);
Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 47, 'A4', 'FAILED');
Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1', 'FAILED');
Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1', 'SUCCESS');
INSERTION of REM in SEND_BILLS
TOGETHER TO DEFINE
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 25, 'A5');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 47, 'A4');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('09-OCT-15','DD-MON-RR'), 19, 'A8');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 20, 'A1');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 25, 'A5');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 25, 'A5');
I match all records of send_bills and received_bills with a status of 'SUCCESS' There is no single column in the table.
Correspondence held payment of columns, the code and the scratch cards, but it may also duplicate records. But even if there are duplicates, I also need those records in the query results
the query I wrote is this:
SELECT SEND.*
REC received_bills, send_bills send
WHERE send.datum = rec.datum
AND send.payment = rec.payment
AND send.code = rec.code
AND 'rec.status =' SUCCESS
;
The query results give me this
OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 25 A5 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 25 A5 The result of the correct application would be
OCTOBER 10, 15 19 A1 OCTOBER 10, 15 25 A5 OCTOBER 10, 15 19 A1 The select statement that I need I want to use a loop to insert records in another table.
Can someone help me please?
Thanks in advance.
Best regards
Caroline
Hi, Caroline.
Caroline wrote:
Hi all
I need help in what follows.
I have 2 tables Received_bills and Send_bills.
-------------------------------------------------------
-The DOF for Table SEND_BILLS
--------------------------------------------------------
CREATE TABLE SEND_BILLS
(DATE OF "DATUM",
NUMBER OF "PAYMENT."
'CODE' VARCHAR2 (5 BYTE)
) ;
--------------------------------------------------------
-The DOF for Table RECEIVED_BILLS
--------------------------------------------------------
CREATE TABLE 'RECEIVED_BILLS '.
(DATE OF "DATUM",
NUMBER OF "PAYMENT."
'CODE' VARCHAR2 (5 BYTE),
VARCHAR2 (5 BYTE) 'STATUS');
INSERTION of REM in RECEIVED_BILLS
TOGETHER TO DEFINE
Insert. RECEIVED_BILLS (DATUM, PAYMENT, CODE, STATE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1', 'SUCCESS');
Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 'A5', 'SUCCESS', 25);
Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 47, 'A4', 'FAILED');
Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1', 'FAILED');
Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1', 'SUCCESS');
INSERTION of REM in SEND_BILLS
TOGETHER TO DEFINE
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 25, 'A5');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 47, 'A4');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('09-OCT-15','DD-MON-RR'), 19, 'A8');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 20, 'A1');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 25, 'A5');
Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 25, 'A5');
I match all records of send_bills and received_bills with a status of 'SUCCESS' There is no single column in the table.
Correspondence held payment of columns, the code and the scratch cards, but it may also duplicate records. But even if there are duplicates, I also need those records in the query results
the query I wrote is this:
SELECT SEND.*
REC received_bills, send_bills send
WHERE send.datum = rec.datum
AND send.payment = rec.payment
AND send.code = rec.code
AND 'rec.status =' SUCCESS
;
The query results give me this
OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 25 A5 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 25 A5 The result of the correct application would be
OCTOBER 10, 15 19 A1 OCTOBER 10, 15 25 A5 OCTOBER 10, 15 19 A1 The select statement that I need I want to use a loop to insert records in another table.
Can someone help me please?
Thanks in advance.
Best regards
Caroline
Want to get answers that work? Then make sure that the CREATE TABLE and INSERT statements you post too much work. Test (and, if necessary, correct) your statements before committing. You have a stray "." in the first INSERT statement for received_bills and receikved_bills.status is defined as VARCHAR2 (5), but all values are 6 characters long.
There are 5 lines in send_bills that are similar to the
10 OCTOBER 2015 19 A1
Why do you want that 2 rows like this in the output, not 1 or 3, or 4 or 5? Is it because there are 2 matching rows in received_bills? If so, you can do something like this:
WITH rec AS
(
SELECT the reference, payment, code
, ROW_NUMBER () OVER (PARTITION BY datum, payment, code)
ORDER BY NULL
) AS r_num
OF received_bills
Situation WHERE = 'SUCCESS'
)
send AS
(
SELECT the reference, payment, code
, ROW_NUMBER () OVER (PARTITION BY datum, payment, code)
ORDER BY NULL
) AS r_num
OF send_bills
)
SELECT send.datum, send.payment, send.code
REC, send
WHERE send.datum = rec.datum
AND send.payment = rec.payment
AND send.code = rec.code
AND send.r_num = rec.r_num
;
Note that the main request is very similar to the query you posted, but the last condition has changed.
If you need to insert these lines in another table, you can use this query in an INSERT statement. There is no need of a loop, or for any PL/SQL.
-
APEX 5.0 Export to CSV produces duplicate records
Good day to you all:
I use APEX 5.0, and I have a classic report that has a total number of lines of 274. (274 documents also in SQL Developer). However, when I export the report to CSV, duplicate records are produced and the total number of lines increases to 365. Has anyone already known this before bug in APEX 5.0? I tried to reproduce the report to a type of interactive, but I get the same results when you export to CSV. Advice or guidance would be appreciated. Thank you.
Aqua
Hey Aqua,
If you are APEX 5.0.0 or 5.0.1? And which version of the database, you are on?
There was a problem with CLOB (which are used for the download) in 5.0.0 running on specific versions of 11 GR 2. A fix is included in the 5.0.1 patch set.
Concerning
Patrick
-
Check duplicate record all by preventing insertion
Hello
I have a scenario where I need to insert records from 20 000 to 30 000 daily in a table that has data in millions.
Keep inserting a record in duplicate and in the event of any duplicate record, this issue need to be logged in another table.
I used FORALL except SAVE to allow loading of all records not not duplicate. But with this approach, I am unable to know which record was duplicate or problems in the insertion.
Also I can't use triggers to connect each record before insertion because I only need the duplicate records. Also, trigger will slow down performance.
Guide kindly on what approach I should follow to do this (which are also good performance as data are huge).
Kind regards
Karki
Logging error clause does not support dyrect path operations, you must remove the Add indicator to use.
This is because the logging of errors using autonomous transaction.
create table test_tomkt_raw (c1 varchar2(20), c2 varchar2(20), c3 varchar2(20)); Table created Executed in 0,015 seconds create table test_mkt (c1 varchar2(20), c2 varchar2(20), c3 varchar2(20)); Table created Executed in 0,031 seconds create table test_mkt_log (c1 varchar2(20), c2 varchar2(20), c3 varchar2(20)); Table created Executed in 0,078 seconds insert into test_tomkt_raw VALUES( 'A','B','C'); 1 row inserted Executed in 0,015 seconds insert into test_tomkt_raw VALUES( 'A','B','C'); 1 row inserted Executed in 0 seconds insert into test_tomkt_raw VALUES( 'D','E','F'); 1 row inserted Executed in 0 seconds insert into test_tomkt_raw VALUES( 'R','BD','AC'); 1 row inserted Executed in 0 seconds insert into test_tomkt_raw VALUES( 'AQ','SB','AC'); 1 row inserted Executed in 0,016 seconds insert into test_tomkt_raw VALUES( 'AA','BA','CA'); 1 row inserted Executed in 0 seconds insert into test_tomkt_raw VALUES( 'A','B','C'); 1 row inserted Executed in 0 seconds insert into test_tomkt_raw VALUES( 'D','E','F'); 1 row inserted Executed in 0,016 seconds ALTER TABLE test_mkt ADD PRIMARY KEY (C1,C2,C3); Table altered Executed in 0,015 seconds BEGIN DBMS_ERRLOG.CREATE_ERROR_LOG('test_mkt'); END; / PL/SQL procedure successfully completed Executed in 0,031 seconds INSERT /* APPEND */ INTO TEST_MKT SELECT * FROM TEST_TOMKT_RAW LOG ERRORS INTO ERR$_TEST_MKT ('TEST_01') --> This can be a variable on your code to identify this operation REJECT LIMIT UNLIMITED ; 5 rows inserted Executed in 0,063 seconds INSERT INTO test_mkt_log SELECT er.c1, er.c2, er.c3 FROM ERR$_TEST_MKT er WHERE er.ora_err_tag$ = 'TEST_01'--> This can be a variable on your code AND er.ora_err_number$ = 1 --> Unique constraint violated ; 3 rows inserted Executed in 0 seconds SELECT * FROM TEST_MKT ; C1 C2 C3 -------------------- -------------------- -------------------- A B C AA BA CA AQ SB AC D E F R BD AC Executed in 0,062 seconds SELECT * FROM TEST_MKT_LOG ; C1 C2 C3 -------------------- -------------------- -------------------- A B C A B C D E F Executed in 0,047 seconds DROP TABLE test_tomkt_raw; Table dropped Executed in 0,032 seconds DROP TABLE test_mkt; Table dropped Executed in 0,094 seconds DROP TABLE err$_test_mkt; Table dropped Executed in 0,078 seconds DROP TABLE test_mkt_log; Table dropped Executed in 0,047 seconds
-
Problem joining tables; duplicate records
I have problems with my request. She joined essentially three tables. I am inside the environment of the Apex, but this problem is with my request. I have three tables:
JOBS
Job_Id PK
Job_Number
Goal
Title
JOB_BUNDLES
Job_Bundle_Id PK
Modification_Number
Justification
Job_Id FK
JOB_TASKS
Job_Task_Id
Sequence
Task_Id (values can be either 1,2,3,4,5 or 6)
Job_Bundle_Id FK
You can see the stream / connection between each table. A JOB can have several JOB_BUNDLES and one can JOB_BUNDLE have JOB_TASKS a lot. One-to-many relationships
My query now displays a report of JOB_BUNDLES for a given job, represented in the form:
SELECT Job_Bundle_Id, Modification_Number, Justification, Job_Id FROM JOB_BUNDLES JB WHERE JB.Job_Id = :P26_Job_Id
The page element, P26_Job_Id represents the Job_Id of the WORK of the table argument. That said, each record JOB_BUNDLE will have JOB_TASKS related records; more specifically, there will be at least a record where JOB. TASKS. Task_Id = 6. This happens only once. I can't get my information from the request that I submitted and the information from the table JOB_TASKS where the Task_Id = 6. I tried to add a JOIN and a WHERE clause, but I still get duplicate records. If anyone has some insight on this issue, it would be greatly appreciated. Thanks in advance.
What:
SQL > select b.*
2, (select t.sequence
job_tasks 3 t
4 where t.job_bundle_id = b.job_bundle_id
5 and t.task_id = 6
(6) seq
job_bundles 7 b
8 where b.job_id = 1;
JOB_BUNDLE_ID MODIFICATION_NUMBER JUSTIFICATION JOB_ID SEQ
------------- ------------------- ------------------------------ ---------- ----------
1 0 there is no justification 1 12
2 that 1 I'm just here for test 1
3 2 it's the third amendment 1 7
3 selected lines.
-
Get different results even script according to what VM it hits?
Hello.
IM starting to Powershell and PowerCLI, so you will know at what level it is on =)
I get different results depending on what VM my script hits (whetever they may or may not have more than one drive). I do not understand how I can fix this...
For example, I created 4 new virtual machines.
TestVMfirst1 have only a single drive
TestVM02 have 2 drives
TestVM03 have 3 discs
TestVM04 have only a single drive
My goal is to get a CSV with all disks included. I want the name, the data store and SizeGB, this info I get from Get-hard drive.
When I run my script to select all 4 virtual machines:
$VMs = get-cluster-name kluster01 : get-vm-name TestVM *
-----------------------------------------------------------------------------
$VMs = get-cluster-name kluster01 | Get-vm-name TestVM *.
$Results = @)
{foreach ($VM to $VMs)
$Result = new-object PSObject
$Result | Add-Member - membertype NoteProperty-name 'Name' - value $VM. Name
$VMDiskCount = 1
Get-$VM hard drive | {foreach}
$disk = $_
$Result | Add-Member-'Disc ($VMDiskCount) name' name-value $disk. Name - membertype NoteProperty
$Result | Add-Member-name '($VMDiskCount) Datastore disk' - value $disk. Filename.Split(']') [0]. TrimStart('[') - membertype NoteProperty
$Result | Add-Member-name 'Disk ($VMDiskCount) SizeGB' - value ([math]: round ($disk.) CapacityKB / 1 MB))-membertype NoteProperty
$VMDiskCount ++
}
$Results += $Result
}
$Results | Select-object * | format-table
-----------------------------------------------------------------------------
I get the result with max 1 disc:
Name (1) name of disc Disk data store (1) SizeGB disc (1) ---- ----------- ---------------- ------------- TestVMfirst1 Hard drive 1 DS-201 40 TestVM02 Hard drive 1 DS-201 40 TestVM03 Hard drive 1 DS-201 40 But if I run the same thing but with TestVM0 * (selects 4-2 VMs):
$VMs = get-cluster-name kluster01 | Get-vm-name TestVM0 *.
-----------------------------------------------------------------------------
$VMs = get-cluster-name kluster01 | Get-vm-name TestVM0 *.
$Results = @)
{foreach ($VM to $VMs)
$Result = new-object PSObject
$Result | Add-Member - membertype NoteProperty-name 'Name' - value $VM. Name
$VMDiskCount = 1
Get-$VM hard drive | {foreach}
$disk = $_
$Result | Add-Member-'Disc ($VMDiskCount) name' name-value $disk. Name - membertype NoteProperty
$Result | Add-Member-name '($VMDiskCount) Datastore disk' - value $disk. Filename.Split(']') [0]. TrimStart('[') - membertype NoteProperty
$Result | Add-Member-name 'Disk ($VMDiskCount) SizeGB' - value ([math]: round ($disk.) CapacityKB / 1 MB))-membertype NoteProperty
$VMDiskCount ++
}
$Results += $Result
}
$Results | Select-object * | format-table
-----------------------------------------------------------------------------
I get this result:
Name (1) name of disc Disk data store (1) (1) name of the disc SizeGB disc (2). Disk data store (2) SizeGB disc (2) ---- ----------- ---------------- ------------- ----------- ---------------- ------------- TestVM02 Hard drive 1 DS-201 Hard 40 2 disc DS-201 10 TestVM03 Hard drive 1 DS-201 Hard 40 2 disc DS-202 10 TestVM04 Hard drive 1 DS-201 40 I miss all my disks on TestVM03, I seems that the first VM sets the limit on how many records can be issued in the table... A dirty solution is to create a model on the first target VM disks, but it seems the wrong way to solve my problem.
Thanks in advance
You're conclusion is correct, I'm afraid, the first line determines how many properties, you will see.
Alternatively, you can sort the lines on the number of properties in descending order.
Something like that
$Result | Tri-objet-property {($_ |)} Get - Member). {Count of}-descending | Format-Table
-
Different results of exactly the same query
Hello
I wrote a function to calculate the days between 2 dates. If I am running in SQL Developer or directly on the oracle server, I get the results I expected. However, if I run on a client by using ODBC, or PHP connection via the OCI8 extension, I get an incorrect result.
The function takes 2 parameters: 1st and 2nd date and should output the number of non-working days (weekends and holidays) between 2 dates. The coding is not very pretty, but it does not work very well as I said since the client SQL Developer.
Here is the code:
The problem is only with certain dates. For example, if I use the date '17-SEP-2012' for the two input parameters, I'm waiting for a result draw. In the SQL Developer client, I get the expected result. However, using ODBC or PHP OCI8 (which I believe is using a direct connection to TNS in the DB), the result returned is '1', which is incorrect ("17-SEP-2012" has been a MONDAY ""). If I use the current date (20-SEP-2012), I get the expected (zero) result in both the SQL Developer client and ODBC/PHP client.create or replace FUNCTION NON_WORKDAYS(fromdate IN DATE, todate IN DATE) --Function to calculate non working days between 2 given dates (Weekends & Bank Holidays) --Update: Added in a calendar for bank holidays. Bank holidays are listed to the end of 2013 RETURN NUMBER IS BANK_HOLS NUMBER; ret NUMBER; BEGIN SELECT count(mydate) INTO ret FROM (SELECT TO_DATE (fromdate, 'dd-mon-yyyy hh24:mi:ss') + LEVEL - 1 mydate FROM DUAL CONNECT BY LEVEL < = TO_DATE (todate, 'dd-mon-yyyy hh24:mi:ss') - TO_DATE (fromdate, 'dd-mon-yyyy hh24:mi:ss') + 1) WHERE TO_CHAR (mydate, 'DY') IN ('SAT', 'SUN'); select count(mydate) into BANK_HOLS from ( SELECT TO_DATE (fromdate, 'dd-mon-yyyy hh24:mi:ss') + LEVEL - 1 mydate FROM DUAL CONNECT BY LEVEL < = TO_DATE (todate, 'dd-mon-yyyy hh24:mi:ss') - TO_DATE (fromdate, 'dd-mon-yyyy hh24:mi:ss') + 1 ) WHERE TO_CHAR (mydate, 'DD-MM-YYYY') IN ('03-01-2011', '22-04-2011', '25-04-2011', '29-04-2011', '02-05-2011', '30-05-2011', '29-08-2011', '26-12-2011', '27-12-2011', '02-01-2012', '06-04-2012', '09-04-2012', '07-05-2012', '04-06-2012', '05-06-2012', '12-07-2012', '27-08-2012', '25-12-2012', '26-12-2012', '01-01-2013', '29-03-2013', '01-04-2013', '06-05-2013', '27-05-2013', '12-07-2013', '26-08-2013', '25-12-2013', '26-12-2013' ); ret:= ret + BANK_HOLS; RETURN ret; end;
I also tried to use variants of SYSDATE in place and place the date string, to see if I get different results (i.e. today is 20-SEP-2012, so I used SYSDATE-3 to 17-SEP-2012).
To be clear, I call the function in a select statement: select (sysdate-3, sysdate-3) non_workdays of the double; or select non_workdays (TO_DATE('17-SEP-2012'), TO_DATE('17-SEP-2012')) of double;
I have spent hours and hours of troubleshooting this, and it makes me crazy!
I also checked the view V$ SQLAREA the Oracle DB to see what is actually passed to the ODBC client database engine. I was expecting the statement became corrupted somehow, that's why I get strange results, but this was not the case. The statement in the column SQL_FULLTEXT of V$ SQLAREA, showed exactly the statement I performed on the ODBC Client. I tried with the oracle instantclient and full client (10g).
Can someone help save my sanity please? I am eternally grateful!
Sorry for the massive post!
Published by: user12199535 on 20-Sep-2012 12:20Your code is a mess. You convert DATE to DATE, e.g. TO_DATE (fromdate, 'dd-mon-yyyy hh24:mi:ss'). TO_DATE function first parameter is a string, while fromdate is the date. That's why Oracle implicitly converts fromdate to the string of default date format that is client dependent and therefore can produce different results on different customers boxes. In addition, your code is dependent on NLS. If the customer has other date language settings, for example German, Sun and SAT are false. And there is no need to separately calculate the weekends and holidays:
create or replace FUNCTION NON_WORKDAYS(fromdate IN DATE, todate IN DATE) --Function to calculate non working days between 2 given dates (Weekends & Bank Holidays) --Update: Added in a calendar for bank holidays. Bank holidays are listed to the end of 2013 RETURN NUMBER IS BANK_HOLS NUMBER; ret NUMBER; BEGIN SELECT count(mydate) INTO ret FROM ( SELECT trunc(fromdate) + LEVEL - 1 mydate FROM DUAL CONNECT BY LEVEL < = trunc(todate) - trunc(fromdate) + 1 ) WHERE TO_CHAR(mydate,'DY','NLS_DATE_LANGUAGE = ENGLISH') IN ('SAT','SUN') OR mydate IN ( DATE '2011-01-03', DATE '2011-04-22', DATE '2011-04-25', DATE '2011-04-29', DATE '2011-05-02', DATE '2011-05-30', DATE '2011-08-29', DATE '2011-12-26', DATE '2011-12-27', DATE '2012-01-02', DATE '2012-04-06', DATE '2012-04-09', DATE '2012-05-07', DATE '2012-06-04', DATE '2012-06-05', DATE '2012-07-12', DATE '2012-08-27', DATE '2012-12-25', DATE '2012-12-26', DATE '2013-01-01', DATE '2013-03-29', DATE '2013-04-01', DATE '2013-05-06', DATE '2013-05-27', DATE '2013-07-12', DATE '2013-08-26', DATE '2013-12-25', DATE '2013-12-26' ); RETURN ret; end; /
SY.
P.S. I think that I converted your vacation to literals correctly, but still double check date. -
ROW_NUMBER and duplicate records
Hello
Tried to delete duplicate records. The code below works, but would remove all, rather than simply the > #1 records:
(SELECT academic_period, load_week, sub_academic_period, person_uid, course_number,
course_reference_number, rowid that RID, row_number() over (partition of)
academic_period, load_week, sub_academic_period, person_uid, course_number,
order of course_reference_number of academic_period, load_week, sub_academic_period,
person_uid, course_number, course_reference_number)
Of THE cea
WHERE (academic_period, load_week, sub_academic_period, person_uid, course_number,)
IN course_reference_number)
(SELECT academic_period, load_week, sub_academic_period, person_uid, course_number,
course_reference_number
Of THE cea
GROUP of academic_period, load_week, sub_academic_period, person_uid, course_number,
course_reference_number
HAVING COUNT (*) > 1))
If I try to put 'rn' and rn > 1, I get ora-00933: Sql not correctly completed command
SELECT academic_period, load_week, sub_academic_period, person_uid, course_number,
course_reference_number, rowid that RID, row_number() over (partition of)
academic_period, load_week, sub_academic_period, person_uid, course_number,
order of course_reference_number of academic_period, load_week, sub_academic_period,
person_uid, course_number, course_reference_number): the nurse
Of THE cea
WHERE (academic_period, load_week, sub_academic_period, person_uid, course_number,)
IN course_reference_number)
(SELECT academic_period, load_week, sub_academic_period, person_uid, course_number,
course_reference_number
Of THE cea
GROUP of academic_period, load_week, sub_academic_period, person_uid, course_number,
course_reference_number
After HAVING COUNT (*) > 1)
and rn > 1
I tried to remove as"rn" and make "rn" and "rn", which gave me an error of syntax also. The '' rn > 1 and '' clause gets an error of syntax also. I gone through a bunch of different Web sites. All of this indicates the syntax I am using will work. However, any query I run into a TOAD, always error when I include the 'rn > 1.
Any ideas? Thank you!
VictoriaYou mix two ways to identify duplicates.
One way is HAVING:
SELECT academic_period, load_week, sub_academic_period, person_uid, course_number, course_reference_number FROM cea GROUP BY academic_period, load_week, sub_academic_period, person_uid, course_number, course_reference_number HAVING COUNT(*) > 1)
That tells you just what combinations of your group are more than once.
Another way is to analytical functions:
select * from ( SELECT academic_period, load_week, sub_academic_period, person_uid, course_number, course_reference_number count(*) over (partition by academic_period, load_week, sub_academic_period, person_uid, course_number, course_reference_number) cnt FROM cea ) where cnt > 1
This will all return duplicate records - if some combinations has three duplicates, then this will return all three lines.
If you use the ROW_NUMBER() place COUNT() analytical analytical function, you get this:
select * from ( SELECT academic_period, load_week, sub_academic_period, person_uid, course_number, course_reference_number row_number() over (partition by academic_period, load_week, sub_academic_period, person_uid, course_number, course_reference_number) rn FROM cea ) where rn > 1
All of these files without duplicates will get rn = 1. Those with duplicates gets rn = 1, rn = 2... If rn > 1 Gets all "unnecessary" records - the ones you want to remove.
If a deletion might look like:
delete cea where rowid in ( select rid from ( SELECT ROWID as rid, row_number() over (partition by academic_period, load_week, sub_academic_period, person_uid, course_number, course_reference_number) rn FROM cea ) where rn > 1 )
Or if you want to manually inspect before you delete ;-):
select * from cea where rowid in ( select rid from ( SELECT ROWID as rid, row_number() over (partition by academic_period, load_week, sub_academic_period, person_uid, course_number, course_reference_number) rn FROM cea ) where rn > 1 )
In another answer, you can find a way to remove duplicates with HAVING.
The point is that do you it either with or with ROW_NUMBER() - not both HAVING ;-) -
finding duplicate records in the DB table, or the data trasnpose
Hello
I have a question...
Key | UID. Start Dt | End date. / / DESC
--------------------------------------------------------------------------------
1. 101 | March 12 09 | 30 May 09 | UID101
2. 101 | January 1 09 | February 25 09 | UID101
3. 102. 13 March 09 | 30 March 09 | UID102
4. 103. 13 March 09 | 30 March 09 | UID103
5. 103. 13 March 09 | April 1 09 | UID103
6. 104. 13 March 09 | 30 May 09 | UID104
7. 104. February 25 09 | 29 May 09 | UID104
8. 105. 15 February 09 | March 1 09 | UID105
9. 105. April 1 09 | 30 May 09 | UID105
The query must know UID in duplicate according to the above data, which are stored in the same form in a table. The definition of the UID duplicate is
(1) UID repeating themselves (records by 2) ex are 101,103,104 and 105.
(2) each UID has two dates and date of end of beginning.
(3) the UID for which dates are overlaping. For ex: touch #4, 103 UID whose start dates are March 13 09-30-Mar-09 and there also another record, with the # 5 UID 103 key dates are 13 Mar 09 to 1 April 09. Here, there is overlap or intersection in line #4 with key #5 key dates dates of rank. This UID is duplicated UID by def.
What precedes that falls under def and selectable are 103 and 104 only 102 UID has only a single line, UID 105 dates are mutually exclusive or not that overlap and even for the UID.
Is there a function available DB to make use of?
Wanted not to delete records or duplicate records.
There is a report to display these duplicate records.
It would be good for me if I can get the data transposed for UID
as
Of
4. 103. 13 March 09 | 30 March 09 | UID103
5. 103. 13 March 09 | April 1 09 | UID103
TO
UID. Start the t1d. End t1d. Start the T2D. End T2D
103: |13-Mar-09|30-Mar-091-Apr-09 13 March 09
Any advice or ideas can be useful to gr8
Thank you...It can also be done without Analytics:
WITH test_data AS ( SELECT 1 AS KEY, 101 AS UD, TO_DATE('03/12/2009','MM/DD/YYYY') AS START_DT, TO_DATE('05/30/2009','MM/DD/YYYY') AS END_DT, 'UD101' AS DSC FROM DUAL UNION ALL SELECT 2 AS KEY, 101 AS UD, TO_DATE('01/01/2009','MM/DD/YYYY') AS START_DT, TO_DATE('02/25/2009','MM/DD/YYYY') AS END_DT, 'UD101' AS DSC FROM DUAL UNION ALL SELECT 3 AS KEY, 102 AS UD, TO_DATE('03/13/2009','MM/DD/YYYY') AS START_DT, TO_DATE('03/30/2009','MM/DD/YYYY') AS END_DT, 'UD102' AS DSC FROM DUAL UNION ALL SELECT 4 AS KEY, 103 AS UD, TO_DATE('03/13/2009','MM/DD/YYYY') AS START_DT, TO_DATE('03/30/2009','MM/DD/YYYY') AS END_DT, 'UD103' AS DSC FROM DUAL UNION ALL SELECT 5 AS KEY, 103 AS UD, TO_DATE('03/13/2009','MM/DD/YYYY') AS START_DT, TO_DATE('04/01/2009','MM/DD/YYYY') AS END_DT, 'UD103' AS DSC FROM DUAL UNION ALL SELECT 6 AS KEY, 104 AS UD, TO_DATE('03/13/2009','MM/DD/YYYY') AS START_DT, TO_DATE('05/30/2009','MM/DD/YYYY') AS END_DT, 'UD104' AS DSC FROM DUAL UNION ALL SELECT 7 AS KEY, 104 AS UD, TO_DATE('02/25/2009','MM/DD/YYYY') AS START_DT, TO_DATE('05/29/2009','MM/DD/YYYY') AS END_DT, 'UD104' AS DSC FROM DUAL UNION ALL SELECT 8 AS KEY, 105 AS UD, TO_DATE('02/15/2009','MM/DD/YYYY') AS START_DT, TO_DATE('03/01/2009','MM/DD/YYYY') AS END_DT, 'UD105' AS DSC FROM DUAL UNION ALL SELECT 9 AS KEY, 105 AS UD, TO_DATE('04/01/2009','MM/DD/YYYY') AS START_DT, TO_DATE('05/30/2009','MM/DD/YYYY') AS END_DT, 'UD105' AS DSC FROM DUAL ) select t1.ud, t1.key, t1.start_dt, t1.end_dt, t2.key, t2.start_dt, t2.end_dt from test_data t1 , test_data t2 where t1.ud = t2.ud and t1.key < t2.key and ((t1.end_dt - t1.start_dt) + (t2.end_dt - t2.start_dt)) > (greatest(t1.end_dt, t2.end_dt) - least(t1.start_dt, t2.start_dt)) /
Result:
UD KEY START_DT END_DT KEY START_DT END_DT ---------- ---------- ---------- ---------- ---------- ---------- ---------- 103 4 13-03-2009 30-03-2009 5 13-03-2009 01-04-2009 104 6 13-03-2009 30-05-2009 7 25-02-2009 29-05-2009
In addition, you will need to adjust the date a little comparison, depending on whether you set two periods where the first End_date is equal to the start_date in the second, because duplication or not.
Published by: tijmen on December 21, 2009 06:17
-
same query gives a different result under 2 different schema.
Hello
I have a query that shows two different results under 2 different schema.
Here's the code.
SELECT ssbsect_term_code, ssbsect_crn, ssbsect_seq_numb,
SUBSTR (f_active_section_ind (ssbsect_ssts_code), 1, 1),
SUBSTR (f_active_course_ind (a.scbcrse_csta_code), 1, 1),
SUBSTR (f_check_for_course_coreqs, (ssbsect_subj_code,
ssbsect_crse_numb,
ssbsect_term_code
),
1,
1
),
SUBSTR (f_check_for_course_prereqs, (ssbsect_subj_code,
ssbsect_crse_numb,
ssbsect_term_code,
''
),
1,
1
),
SUBSTR (f_check_for_section_coreqs (ssbsect_term_code, ssbsect_crn),
1,
1
),
SUBSTR (f_check_for_section_prereqs, (ssbsect_term_code,
ssbsect_crn,
''
),
1,
1
),
a.scbcrse_eff_term, a.scbcrse_coll_code, a.scbcrse_dept_code,
SUBSTR (f_get_course_levels, (ssbsect_subj_code,
ssbsect_crse_numb,
ssbsect_term_code,
1
),
1,
2
),
SUBSTR (f_get_course_levels, (ssbsect_subj_code,
ssbsect_crse_numb,
ssbsect_term_code,
2
),
1,
2
),
SUBSTR (f_get_course_levels, (ssbsect_subj_code,
ssbsect_crse_numb,
ssbsect_term_code,
3
),
1,
2
),
SUBSTR (f_get_course_levels, (ssbsect_subj_code,
ssbsect_crse_numb,
ssbsect_term_code,
4
),
1,
2
),
a.scbcrse_divs_code, ssbsect_subj_code, ssbsect_crse_numb,
a.scbcrse_ceu_ind, a.scbcrse_csta_code,
NVL (ssbsect_credit_hrs, a.scbcrse_credit_hr_low),
a.scbcrse_credit_hr_low, a.scbcrse_credit_hr_high,
a.scbcrse_credit_hr_ind,
NVL (ssbsect_bill_hrs, a.scbcrse_bill_hr_low),
a.scbcrse_bill_hr_low, a.scbcrse_bill_hr_high,
a.scbcrse_bill_hr_ind, ssbsect_ssts_code, ssbsect_camp_code,
NVL (ssbsect_gmod_code,
SUBSTR (f_default_gmod, (ssbsect_subj_code,
ssbsect_crse_numb,
ssbsect_term_code
),
1,
1
)
),
NVL (ssbsect_crse_title, a.scbcrse_title), ssbsect_sapr_code,
ssbsect_census_enrl, ssbsect_census_enrl_date,
ssbsect_census_2_enrl, ssbsect_census_2_date, ssbsect_proj_enrl,
ssbsect_max_enrl, ssbsect_enrl, ssbsect_seats_avail,
ssbsect_ptrm_code, ssbsect_ptrm_start_date, ssbsect_ptrm_end_date,
ssbsect_link_ident, k.ssrmeet_begin_time, k.ssrmeet_end_time,
k.ssrmeet_bldg_code, k.ssrmeet_room_code, k.ssrmeet_schd_code,
k.ssrmeet_mon_day, k.ssrmeet_tue_day, k.ssrmeet_wed_day,
k.ssrmeet_thu_day, k.ssrmeet_fri_day, k.ssrmeet_sat_day,
k.ssrmeet_sun_day, l.ssrmeet_begin_time, l.ssrmeet_end_time,
l.ssrmeet_bldg_code, l.ssrmeet_room_code, l.ssrmeet_schd_code,
l.ssrmeet_mon_day, l.ssrmeet_tue_day, l.ssrmeet_wed_day,
l.ssrmeet_thu_day, l.ssrmeet_fri_day, l.ssrmeet_sat_day,
l.ssrmeet_sun_day, m.ssrmeet_begin_time, m.ssrmeet_end_time,
m.ssrmeet_bldg_code, m.ssrmeet_room_code, m.ssrmeet_schd_code,
m.ssrmeet_mon_day, m.ssrmeet_tue_day, m.ssrmeet_wed_day,
m.ssrmeet_thu_day, m.ssrmeet_fri_day, m.ssrmeet_sat_day,
m.ssrmeet_sun_day, n.ssrmeet_begin_time, n.ssrmeet_end_time,
n.ssrmeet_bldg_code, n.ssrmeet_room_code, n.ssrmeet_schd_code,
n.ssrmeet_mon_day, n.ssrmeet_tue_day, n.ssrmeet_wed_day,
n.ssrmeet_thu_day, n.ssrmeet_fri_day, n.ssrmeet_sat_day,
n.ssrmeet_sun_day, o.ssrmeet_begin_time, o.ssrmeet_end_time,
o.ssrmeet_bldg_code, o.ssrmeet_room_code, o.ssrmeet_schd_code,
o.ssrmeet_mon_day, o.ssrmeet_tue_day, o.ssrmeet_wed_day,
o.ssrmeet_thu_day, o.ssrmeet_fri_day, o.ssrmeet_sat_day,
o.ssrmeet_sun_day, p.ssrmeet_begin_time, p.ssrmeet_end_time,
p.ssrmeet_bldg_code, p.ssrmeet_room_code, p.ssrmeet_schd_code,
p.ssrmeet_mon_day, p.ssrmeet_tue_day, p.ssrmeet_wed_day,
p.ssrmeet_thu_day, p.ssrmeet_fri_day, p.ssrmeet_sat_day,
p.ssrmeet_sun_day, q.ssrmeet_begin_time, q.ssrmeet_end_time,
q.ssrmeet_bldg_code, q.ssrmeet_room_code, q.ssrmeet_schd_code,
q.ssrmeet_mon_day, q.ssrmeet_tue_day, q.ssrmeet_wed_day,
q.ssrmeet_thu_day, q.ssrmeet_fri_day, q.ssrmeet_sat_day,
q.ssrmeet_sun_day, r.ssrmeet_begin_time, r.ssrmeet_end_time,
r.ssrmeet_bldg_code, r.ssrmeet_room_code, r.ssrmeet_schd_code,
r.ssrmeet_mon_day, r.ssrmeet_tue_day, r.ssrmeet_wed_day,
r.ssrmeet_thu_day, r.ssrmeet_fri_day, r.ssrmeet_sat_day,
r.ssrmeet_sun_day, s.ssrmeet_begin_time, s.ssrmeet_end_time,
s.ssrmeet_bldg_code, s.ssrmeet_room_code, s.ssrmeet_schd_code,
s.ssrmeet_mon_day, s.ssrmeet_tue_day, s.ssrmeet_wed_day,
s.ssrmeet_thu_day, s.ssrmeet_fri_day, s.ssrmeet_sat_day,
s.ssrmeet_sun_day, t.ssrmeet_begin_time, t.ssrmeet_end_time,
t.ssrmeet_bldg_code, t.ssrmeet_room_code, t.ssrmeet_schd_code,
t.ssrmeet_mon_day, t.ssrmeet_tue_day, t.ssrmeet_wed_day,
t.ssrmeet_thu_day, t.ssrmeet_fri_day, t.ssrmeet_sat_day,
t.ssrmeet_sun_day, T1.ssrmeet_begin_time, t1.ssrmeet_end_time,
T1.ssrmeet_bldg_code, t1.ssrmeet_room_code, t1.ssrmeet_schd_code,
T1.ssrmeet_mon_day, t1.ssrmeet_tue_day, t1.ssrmeet_wed_day,
T1.ssrmeet_thu_day, t1.ssrmeet_fri_day, t1.ssrmeet_sat_day,
T1.ssrmeet_sun_day, e1.ssrattr_attr_code, e2.ssrattr_attr_code,
SUBSTR (f_more_attributes, (scbcrse_subj_code,
scbcrse_crse_numb,
scbcrse_eff_term
),
1,
1
),
x.spriden_id, NVL (x.spriden_last_name, 'STAFF'),
x.spriden_first_name, SUBSTR (x.spriden_mi, 1, 1), y.spriden_id,
y.spriden_last_name, y.spriden_first_name,
SUBSTR (y.spriden_mi, 1, 1), z.spriden_id, z.spriden_last_name,.
z.spriden_first_name, SUBSTR (z.spriden_mi, 1, 1),
DECODE (u.spriden_pidm, NULL, 'n', 'Y'), ssbovrr_coll_code,
ssbovrr_divs_code, ssbovrr_dept_code, f1.scrschd_schd_code,
F1.scrschd_workload, f1.scrschd_max_enrl, f1.scrschd_adj_workload,
F2.scrschd_schd_code, f2.scrschd_workload, f2.scrschd_max_enrl,
F2.scrschd_adj_workload, f3.scrschd_schd_code, f3.scrschd_workload,
F3.scrschd_max_enrl, f3.scrschd_adj_workload, f4.scrschd_schd_code,
F4.scrschd_workload, f4.scrschd_max_enrl, f4.scrschd_adj_workload
Scbcrse a.,
ssbovrr,
spriden x,
spriden,
ssrmeet k,
ssrmeet l,
ssrmeet m,
ssrmeet n,
ssrmeet o,
ssrmeet p,
ssrmeet q,
ssrmeet r,
s ssrmeet,
ssrmeet t,
ssrmeet t1,
scrschd f1,
scrschd f2,
scrschd f3,
scrschd f4,
ssrattr e1,
ssrattr e2,
spriden z,
spriden u,
ssbsect
WHERE x.ROWID (+) =
f_get_instr_spriden_rowid (ssbsect_crn,
ssbsect_term_code,
« Y »,
''
)
AND y.ROWID (+) =
f_get_instr_spriden_rowid (ssbsect_crn, ssbsect_term_code, ', 1).
AND z.ROWID (+) =
f_get_instr_spriden_rowid (ssbsect_crn, ssbsect_term_code, ', 2)
AND u.ROWID (+) =
f_get_instr_spriden_rowid (ssbsect_crn, ssbsect_term_code, cm, 3)
AND ssbovrr_term_code (+) = ssbsect_term_code
AND ssbovrr_crn (+) = ssbsect_crn
AND a.scbcrse_subj_code = ssbsect_subj_code
AND a.scbcrse_crse_numb = ssbsect_crse_numb
AND a.scbcrse_eff_term =
(SELECT MAX (b.scbcrse_eff_term)
OF scbcrse b
WHERE b.scbcrse_subj_code = ssbsect_subj_code
AND b.scbcrse_crse_numb = ssbsect_crse_numb
AND b.scbcrse_eff_term < = ssbsect_term_code)
AND k.ROWID (+) =
gvsuowner.f_get_ssrmeet_rowid_js (ssbsect_term_code,
ssbsect_crn,
1
)
AND l.ROWID (+) =
gvsuowner.f_get_ssrmeet_rowid_js (ssbsect_term_code,
ssbsect_crn,
2
)
AND m.ROWID (+) =
gvsuowner.f_get_ssrmeet_rowid_js (ssbsect_term_code,
ssbsect_crn,
3
)
AND n.ROWID (+) =
gvsuowner.f_get_ssrmeet_rowid_js (ssbsect_term_code,
ssbsect_crn,
4
)
AND o.ROWID (+) =
gvsuowner.f_get_ssrmeet_rowid_js (ssbsect_term_code,
ssbsect_crn,
5
)
AND p.ROWID (+) =
gvsuowner.f_get_ssrmeet_rowid_js (ssbsect_term_code,
ssbsect_crn,
6
)
AND q.ROWID (+) =
gvsuowner.f_get_ssrmeet_rowid_js (ssbsect_term_code,
ssbsect_crn,
7
)
AND r.ROWID (+) =
gvsuowner.f_get_ssrmeet_rowid_js (ssbsect_term_code,
ssbsect_crn,
8
)
AND s.ROWID (+) =
gvsuowner.f_get_ssrmeet_rowid_js (ssbsect_term_code,
ssbsect_crn,
9
)
AND t.ROWID (+) =
gvsuowner.f_get_ssrmeet_rowid_js (ssbsect_term_code,
ssbsect_crn,
10
)
AND t1. ROWID (+) =
gvsuowner.f_get_ssrmeet_rowid_js (ssbsect_term_code,
ssbsect_crn,
11
)
AND f1. ROWID (+) =
f_get_scrschd_rowid (ssbsect_subj_code,
ssbsect_crse_numb,
ssbsect_term_code,
1
)
AND f2. ROWID (+) =
f_get_scrschd_rowid (ssbsect_subj_code,
ssbsect_crse_numb,
ssbsect_term_code,
2
)
AND f3. ROWID (+) =
f_get_scrschd_rowid (ssbsect_subj_code,
ssbsect_crse_numb,
ssbsect_term_code,
3
)
AND f4. ROWID (+) =
f_get_scrschd_rowid (ssbsect_subj_code,
ssbsect_crse_numb,
ssbsect_term_code,
4
)
AND e1.ssrattr_term_code (+) = ssbsect_term_code
AND e1.ssrattr_crn (+) = ssbsect_crn
AND e1.ssrattr_attr_code (+) = "SWS".
AND e2.ssrattr_term_code (+) = ssbsect_term_code
AND e2.ssrattr_crn (+) = ssbsect_crn
AND e2.ssrattr_attr_code (+) LIKE '% TM ";
Thank youuser3367455 wrote:
Hello
I have a query that shows two different results under 2 different schema.Hello
Different how?
-Different number of records, please run this and show us what you get:
select owner, object_name, object_type from dba_objects where object_name in ('SCBCRSE', 'SCRSCHD', 'SPRIDEN', 'SSBOVRR', 'SSBSECT', 'SSRATTR', 'SSRMEET', 'F_GET_INSTR_SPRIDEN_ROWID', 'F_GET_SSRMEET_ROWID_JS') order by object_name;
If different values in some records, also include all functions in your selection list.
Concerning
Peter
Maybe you are looking for
-
Satellite A210 - cannot burn CD - R using iTunes - error 2131
Hi all I know that I'm not the only person having this problem, but I get error 2131 when trying to burn CD - R help (v7.6) iTunes on Windows Vista with an Equium A210 TSST Corp TS-L632H CD - DVD writer. I tried all the usual things like the update o
-
Update of RAM for Satellite Pro 6100
Hello What type of RAM is supported by the Satellite Pro 6100.I need to update some RAM. Thank you much for the help.
-
HP Pavilion 17 laptop PC: System disabled
Im not sure if it's 32 or 64 my apoligies. Disabled code 51043119
-
BIOS Configuration Utility (BCU) for HP Z840 workstation.
Took a look in the download section for the workstation Z840 but could not find. Someone has a link to this software need a 64-bit version and must be compatible for the new workstation Z840. P.S. This thread was moved from workstations - z dad serie
-
HARD drive toshiba px1267e - 1 g 32 does not
I got my drive HARD Toshiba PX1267E - 1 32 for about 18 months, and it worked fine. However, all of a sudden it has stopped working, it is no longer appears on my desktop. Previously, it was password protected, and the password box will appear first.