Need some SQL help Please...

2003-01-21 Thread Steven Haas
-mon- hh24:mi:ss'),
to_date('17-jan-2003
15:00:00','dd-mon- hh24:mi:ss'),'U',8);

insert into tab_child
values (200,500,to_date('10-jan-2003
10:10:00','dd-mon- hh24:mi:ss'),
to_date('17-jan-2003
15:30:00','dd-mon- hh24:mi:ss'),'U',9);

insert into tab_child
values (200,500,to_date('10-jan-2003
10:10:00','dd-mon- hh24:mi:ss'),
to_date('18-jan-2003
16:50:00','dd-mon- hh24:mi:ss'),'D',10);

commit;



Thanks folks...

Steve

=
Steve Haas
Opus Consultants, LLC
860.408.1512 (office/fax)
860.651.9475 (home)
[EMAIL PROTECTED]
[EMAIL PROTECTED]
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Steven Haas
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).




columns with primary key constraint

2002-12-30 Thread Steven Haas
Good Morning List,

I am trying to build a query to display the
following for any table

column_name is_pk
--- -
COLUMN_1(PK-1)
COLUMN_2(PK-2)
COLUMN_3
COLUMN_4
COLUMN_5
COLUMN_6

I can get the two columns with (PK) with...

select utc.column_name
,decode(ucc.column_name,null,null,'
(PK-'||ucc.position||')') is_pk
from   user_tab_columns utc,
   user_cons_columns ucc,
   user_constraints uc
where  utc.table_name = 'TAB_A'
anduc.constraint_type = 'P'
andutc.table_name = uc.table_name
anduc.constraint_name (+) =
ucc.constraint_name
andutc.column_name (+) = ucc.column_name
order by utc.column_id

but can't seem to get the columns not part of the
PK.  I suspect I am missing an outer-join
somewhere, but can't seem to figure it out.

If possible I would like to put an (FK) next to
columns that have a FK constraint as well.

Thanks.



=
Steve Haas
Opus Consultants, LLC
860.408.1512 (office/fax)
860.651.9475 (home)
[EMAIL PROTECTED]
[EMAIL PROTECTED]
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Steven Haas
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).




RE: columns with primary key constraint

2002-12-30 Thread Steven Haas
Charu,

This is exactly what I was looking for.

I will try to modify this now to include an
(FK) for any column with a foreign key
constraint.

Thanks for the extra pair of eyes.

Happy New Year all!

Steve

--- Charu Joshi [EMAIL PROTECTED] wrote:
 Hi Steve,
 
 Are you looking for something like this?:
 
 SELECT utc.table_name, utc.column_name
 ,DECODE(NVL(ucct.cln, ' '), ' ',' ',
 '(PK-'||ucct.pos||')') is_pk
 FROM   user_tab_columns utc,
 (
 select uc.table_name tn,
 ucc.constraint_name cn, ucc.column_name cln,
ucc.position pos
 FROM   user_cons_columns ucc,
user_constraints uc
 WHERE  ucc.constraint_name =
 uc.constraint_name
 ANDuc.constraint_type = 'P'
 ) ucct
 WHERE utc.table_name = ucct.tn (+)
 AND utc.column_name = ucct.cln (+)
 AND utc.table_name = 'tab_name'
 ORDER BY ucct.pos
 /
 
 Regards,
 Charu
 
 -Original Message-
 Sent: Monday, December 30, 2002 2:39 PM
 To: Multiple recipients of list ORACLE-L
 
 Good Morning List,
 
 I am trying to build a query to display the
 following for any table
 
 column_name is_pk
 --- -
 COLUMN_1(PK-1)
 COLUMN_2(PK-2)
 COLUMN_3
 COLUMN_4
 COLUMN_5
 COLUMN_6
 
 I can get the two columns with (PK) with...
 
 select utc.column_name
 ,decode(ucc.column_name,null,null,'
 (PK-'||ucc.position||')') is_pk
 from   user_tab_columns utc,
user_cons_columns ucc,
user_constraints uc
 where  utc.table_name = 'TAB_A'
 anduc.constraint_type = 'P'
 andutc.table_name = uc.table_name
 anduc.constraint_name (+) =
 ucc.constraint_name
 andutc.column_name (+) = ucc.column_name
 order by utc.column_id
 
 but can't seem to get the columns not part of
 the
 PK.  I suspect I am missing an outer-join
 somewhere, but can't seem to figure it out.
 
 If possible I would like to put an (FK) next
 to
 columns that have a FK constraint as well.
 
 Thanks.
 
 =
 Steve Haas
 Opus Consultants, LLC
 860.408.1512 (office/fax)
 860.651.9475 (home)
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 --
 Please see the official ORACLE-L FAQ:
 http://www.orafaq.net
 --
 Author: Steven Haas
   INET: [EMAIL PROTECTED]
 
 Fat City Network Services-- 858-538-5051
 http://www.fatcity.com
 San Diego, California-- Mailing list
 and web hosting services

-
 To REMOVE yourself from this mailing list, send
 an E-Mail message
 to: [EMAIL PROTECTED] (note EXACT spelling
 of 'ListGuru') and in
 the message BODY, include a line containing:
 UNSUB ORACLE-L
 (or the name of mailing list you want to be
 removed from).  You may
 also send the HELP command for other
 information (like subscribing).
 

*
 Disclaimer
 
 This message (including any attachments)
 contains 
 confidential information intended for a
 specific 
 individual and purpose, and is protected by
 law. 
 If you are not the intended recipient, you
 should 
 delete this message and are hereby notified
 that 
 any disclosure, copying, or distribution of
 this
 message, or the taking of any action based on
 it, 
 is strictly prohibited.
 

*
 Visit us at http://www.mahindrabt.com
 
 
 
 -- 
 Please see the official ORACLE-L FAQ:
 http://www.orafaq.net
 -- 
 Author: Charu Joshi
   INET: [EMAIL PROTECTED]
 
 Fat City Network Services-- 858-538-5051
 http://www.fatcity.com
 San Diego, California-- Mailing list
 and web hosting services

-
 To REMOVE yourself from this mailing list, send
 an E-Mail message
 to: [EMAIL PROTECTED] (note EXACT spelling
 of 'ListGuru') and in
 the message BODY, include a line containing:
 UNSUB ORACLE-L
 (or the name of mailing list you want to be
 removed from).  You may
 also send the HELP command for other
 information (like subscribing).
 

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Steven Haas
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).




RE: Leading spaces in dbms_output.put_line

2002-12-17 Thread Steven Haas
Thanks Bruce.

That was exactly what I needed.


--- Reardon, Bruce (CALBBAY)
[EMAIL PROTECTED] wrote:
 Steve,
 
 Have a look at Metalink Doc ID:  Note:108091.1 
 
 For those without Metalink access this
 suggests:
 1) Use format wrapped at the end of your Set
 Serveroutput command.
 This works with SQL Plus version 3.3 or above.
 This will keep leading spaces and double
 spacing
 
 2) If you're on an older database, you can use 
 CHR(10) and CHR(9) 
 to produce blank lines and leading spaces
 respectively
 
 I have also found that 
 3) chr(0) works as well (found in

http://www.quest-pipelines.com/Pipelines/PLSQL/archives/search.sql)
 
 Cheers,
 Bruce Reardon
 
 -Original Message-
 Sent: Tuesday, 17 December 2002 7:14 AM
 
 Good afternoon,
 
 Some time ago there was a response to the
 question of how to get leading spaces to
 display
 when using dbms_output.put_line.
 
 I have tried -
 dbms_output.put_line('   '||tabrec.table_name);
 
 but do not get the leading spaces.
 
 When someone mentioned how to do this I said
 of
 course but naturally have forgotten the
 technique.
 
 Can some one share?
 
 Thanks folks...
 Steve Haas
 Opus Consultants, LLC
 860.408.1512 (office/fax)
 860.651.9475 (home)
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 -- 
 Please see the official ORACLE-L FAQ:
 http://www.orafaq.com
 -- 
 Author: Reardon, Bruce (CALBBAY)
   INET: [EMAIL PROTECTED]
 
 Fat City Network Services-- 858-538-5051
 http://www.fatcity.com
 San Diego, California-- Mailing list
 and web hosting services

-
 To REMOVE yourself from this mailing list, send
 an E-Mail message
 to: [EMAIL PROTECTED] (note EXACT spelling
 of 'ListGuru') and in
 the message BODY, include a line containing:
 UNSUB ORACLE-L
 (or the name of mailing list you want to be
 removed from).  You may
 also send the HELP command for other
 information (like subscribing).
 


=
Steve Haas
Opus Consultants, LLC
860.408.1512 (office/fax)
860.651.9475 (home)
[EMAIL PROTECTED]
[EMAIL PROTECTED]
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Steven Haas
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).




Leading spaces in dbms_output.put_line

2002-12-16 Thread Steven Haas
Good afternoon,

Some time ago there was a response to the
question of how to get leading spaces to display
when using dbms_output.put_line.

I have tried -
dbms_output.put_line('   '||tabrec.table_name);

but do not get the leading spaces.

When someone mentioned how to do this I said of
course but naturally have forgotten the
technique.

Can some one share?

Thanks folks...



=
Steve Haas
Opus Consultants, LLC
860.408.1512 (office/fax)
860.651.9475 (home)
[EMAIL PROTECTED]
[EMAIL PROTECTED]
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Steven Haas
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).




usage of new_time() function

2002-11-14 Thread Steven Haas
Hey folks,

Oracle 8.1.7, Solaris

I have a possible requirement that all record
timestamps must use GMT.  Has anyone found an
easy way to determine the sysdate timezone to use
in the new_time() function.

Thanks much...

Steve
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Steven Haas
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



Re: Whitepapers on Triggers

2002-11-13 Thread Steven Haas
This is for FDA regulation compliance.  The audit
records need to show every change made to the
source table in order of change.
WHile audit the table will show who changed the
record, it won't show what was changed.

Steve


--- Yechiel Adar [EMAIL PROTECTED] wrote:
 In my browsing of the oracle docs I came across
 a sql statement call
 AUDITING.
 Why invent triggers when oracle does the work
 for you?
 
 Yechiel Adar
 Mehish
 - Original Message -
 To: Multiple recipients of list ORACLE-L
 [EMAIL PROTECTED]
 Sent: Friday, November 08, 2002 6:59 PM
 
 
  Listers,
 
  Oracle 8.1.7
 
  I am looking for any whitepaper(s) that can
  provide guidelines on the creation, use,
  performance and limitations of triggers.
 
  I need to create triggers on possibly 45
 tables
  for auditing purposes.  The first draft
  requirements document indicates denormalizing
  data and generating data for null columns
 using
  the triggers (yeah, bad ideas).  I prefer to
 make
  them as simple as possible and would like to
 have
  the best arguments against doing it the way
 the
  requirements suggest.
 
  TIA,
 
  Steve Haas
 
  Opinions, real or imagined, are mine.
 
  --
  Please see the official ORACLE-L FAQ:
 http://www.orafaq.com
  --
  Author: Steven Haas
INET: [EMAIL PROTECTED]
 
  Fat City Network Services-- 858-538-5051
 http://www.fatcity.com
  San Diego, California-- Mailing list
 and web hosting services
 

-
  To REMOVE yourself from this mailing list,
 send an E-Mail message
  to: [EMAIL PROTECTED] (note EXACT spelling
 of 'ListGuru') and in
  the message BODY, include a line containing:
 UNSUB ORACLE-L
  (or the name of mailing list you want to be
 removed from).  You may
  also send the HELP command for other
 information (like subscribing).
 
 -- 
 Please see the official ORACLE-L FAQ:
 http://www.orafaq.com
 -- 
 Author: Yechiel Adar
   INET: [EMAIL PROTECTED]
 
 Fat City Network Services-- 858-538-5051
 http://www.fatcity.com
 San Diego, California-- Mailing list
 and web hosting services

-
 To REMOVE yourself from this mailing list, send
 an E-Mail message
 to: [EMAIL PROTECTED] (note EXACT spelling
 of 'ListGuru') and in
 the message BODY, include a line containing:
 UNSUB ORACLE-L
 (or the name of mailing list you want to be
 removed from).  You may
 also send the HELP command for other
 information (like subscribing).

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Steven Haas
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: Whitepapers on Triggers

2002-11-13 Thread Steven Haas
That is exactly what my design would be given the
option.  Thanks for concurring.

I have also been asked if the trigger can fire
off a pop-up box in the app to ask for a reason
for change that needs to be in the audit record
as well.  Yeah, really... that's what they want.

Another option suggested for tables with heavy
updates is to record the full insert and only the
column deltas on updates.  Okay, lets compare all
87 columns to see if the new value is the same as
the old value.  Just throw all kinds of junk in
the trigger so it effects its performance.

My origianl question was for any links to
whitepapers on trigger devlopment.

Thanks...

Steve


--- Lisa R. Clary [EMAIL PROTECTED] wrote:
 Since we are in the medical records business,
 we too have the same
 guideline. What we do, is create an exact table
 replica (we call it an
 archive table and it does not have constraints)
 to which before every insert
 and update on the primary table, sends the row
 data to the archive table. It
 stores the modifier and sysdate as well, so we
 have a complete history of
 revision. We don't allow deletes through users,
 only through dbas so that we
 can audit removals. Doing it this way
 eliminates that possibility of the
 fudge-factor on revisions/deletions. And when
 you are audited---it is a
 wonderful thing!
 
 lc
 
 -Original Message-
 Sent: Wednesday, November 13, 2002 11:49 AM
 To: Multiple recipients of list ORACLE-L
 
 
 This is for FDA regulation compliance.  The
 audit
 records need to show every change made to the
 source table in order of change.
 WHile audit the table will show who changed the
 record, it won't show what was changed.
 
 Steve
 
 
 --- Yechiel Adar [EMAIL PROTECTED] wrote:
  In my browsing of the oracle docs I came
 across
  a sql statement call
  AUDITING.
  Why invent triggers when oracle does the work
  for you?
 
  Yechiel Adar
  Mehish
  - Original Message -
  To: Multiple recipients of list ORACLE-L
  [EMAIL PROTECTED]
  Sent: Friday, November 08, 2002 6:59 PM
 
 
   Listers,
  
   Oracle 8.1.7
  
   I am looking for any whitepaper(s) that can
   provide guidelines on the creation, use,
   performance and limitations of triggers.
  
   I need to create triggers on possibly 45
  tables
   for auditing purposes.  The first draft
   requirements document indicates
 denormalizing
   data and generating data for null columns
  using
   the triggers (yeah, bad ideas).  I prefer
 to
  make
   them as simple as possible and would like
 to
  have
   the best arguments against doing it the way
  the
   requirements suggest.
  
   TIA,
  
   Steve Haas
  
   Opinions, real or imagined, are mine.
  
   --
   Please see the official ORACLE-L FAQ:
  http://www.orafaq.com
   --
   Author: Steven Haas
 INET: [EMAIL PROTECTED]
  
   Fat City Network Services--
 858-538-5051
  http://www.fatcity.com
   San Diego, California-- Mailing
 list
  and web hosting services
  
 

-
   To REMOVE yourself from this mailing list,
  send an E-Mail message
   to: [EMAIL PROTECTED] (note EXACT
 spelling
  of 'ListGuru') and in
   the message BODY, include a line
 containing:
  UNSUB ORACLE-L
   (or the name of mailing list you want to be
  removed from).  You may
   also send the HELP command for other
  information (like subscribing).
 
  --
  Please see the official ORACLE-L FAQ:
  http://www.orafaq.com
  --
  Author: Yechiel Adar
INET: [EMAIL PROTECTED]
 
  Fat City Network Services-- 858-538-5051
  http://www.fatcity.com
  San Diego, California-- Mailing list
  and web hosting services
 

-
  To REMOVE yourself from this mailing list,
 send
  an E-Mail message
  to: [EMAIL PROTECTED] (note EXACT spelling
  of 'ListGuru') and in
  the message BODY, include a line containing:
  UNSUB ORACLE-L
  (or the name of mailing list you want to be
  removed from).  You may
  also send the HELP command for other
  information (like subscribing).
 
 --
 Please see the official ORACLE-L FAQ:
 http://www.orafaq.com
 --
 Author: Steven Haas
   INET: [EMAIL PROTECTED]
 
 Fat City Network Services-- 858-538-5051
 http://www.fatcity.com
 San Diego, California-- Mailing list
 and web hosting services

-
 To REMOVE yourself from this mailing list, send
 an E-Mail message
 to: [EMAIL PROTECTED] (note EXACT spelling
 of 'ListGuru') and in
 the message BODY, include a line containing:
 UNSUB ORACLE-L
 (or the name of mailing list you want to be
 removed from).  You may
 also send the HELP command for other
 information (like subscribing).
 
 -- 
 Please see the official ORACLE-L FAQ:
 http://www.orafaq.com
 -- 
 Author: Lisa R. Clary
   INET: [EMAIL PROTECTED]
 
 Fat City Network Services-- 858-538-5051
 http://www.fatcity.com
 San Diego, California

Whitepapers on Triggers

2002-11-08 Thread Steven Haas
Listers,

Oracle 8.1.7

I am looking for any whitepaper(s) that can
provide guidelines on the creation, use,
performance and limitations of triggers.

I need to create triggers on possibly 45 tables
for auditing purposes.  The first draft
requirements document indicates denormalizing
data and generating data for null columns using
the triggers (yeah, bad ideas).  I prefer to make
them as simple as possible and would like to have
the best arguments against doing it the way the
requirements suggest.

TIA,

Steve Haas

Opinions, real or imagined, are mine.

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Steven Haas
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



SQL question

2002-09-23 Thread Steven Haas

Good morning list,

Environment HP-UX 11.0 Oracle 8.1.6

Can anyone help with this SQL.

I can get a result set of values from a table
that match a given list of values -

select code
from table
where code in ('A','B','C','D','E')

I can get a result set of values from a table
that do not match a given list of values -

select code
from table
where code not in ('A','B','C','D','E')

So far so good.

Now, how do I get the set of values from the list
that do NOT have a matching value in the table?

I cannot create any objects in the schema I am
working in otherwise I would create a table with
the values and do a minus, but I can't figure out
how to do it in SQL only.

Thanks in advance, folks.

Steve
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Steven Haas
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: SQL question

2002-09-23 Thread Steven Haas

Dan (and Charlie),

Thanks.
Good suggestions, but the IN clause contains just
over 1700 values.

Puzzling, huh?

steve


--- Fink, Dan [EMAIL PROTECTED] wrote:
 It is a little awkward, but a union in an
 inline query may do the trick:
 
   1  select a.code
   2  from (select '10' code from dual union
   3select '20' code from dual union
   4select '30' code from dual union
   5select '40' code from dual union
   6select '50' code from dual ) a
   7* where a.code not in (select
 to_char(deptno) from emp)
 SQL /
 
 CO
 --
 40
 50
 
 Dan Fink
 
 -Original Message-
 From: Steven Haas [mailto:[EMAIL PROTECTED]]
 Sent: Monday, September 23, 2002 10:28 AM
 To: Multiple recipients of list ORACLE-L
 Subject: SQL question
 
 
 Good morning list,
 
 Environment HP-UX 11.0 Oracle 8.1.6
 
 Can anyone help with this SQL.
 
 I can get a result set of values from a table
 that match a given list of values -
 
 select code
 from table
 where code in ('A','B','C','D','E')
 
 I can get a result set of values from a table
 that do not match a given list of values -
 
 select code
 from table
 where code not in ('A','B','C','D','E')
 
 So far so good.
 
 Now, how do I get the set of values from the
 list
 that do NOT have a matching value in the table?
 
 I cannot create any objects in the schema I am
 working in otherwise I would create a table
 with
 the values and do a minus, but I can't figure
 out
 how to do it in SQL only.
 
 Thanks in advance, folks.
 
 Steve
 -- 
 Please see the official ORACLE-L FAQ:
 http://www.orafaq.com
 -- 
 Author: Steven Haas
   INET: [EMAIL PROTECTED]
 
 Fat City Network Services-- 858-538-5051
 http://www.fatcity.com
 San Diego, California-- Mailing list
 and web hosting services

-
 To REMOVE yourself from this mailing list, send
 an E-Mail message
 to: [EMAIL PROTECTED] (note EXACT spelling
 of 'ListGuru') and in
 the message BODY, include a line containing:
 UNSUB ORACLE-L
 (or the name of mailing list you want to be
 removed from).  You may
 also send the HELP command for other
 information (like subscribing).

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Steven Haas
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: SQL question

2002-09-23 Thread Steven Haas

Dan et al,

I guess that is where I may head with it now.  I
couldn't come up with an easier way.

Thanks all...

steve



--- Fink, Dan [EMAIL PROTECTED] wrote:
 1700 values? I sure hope you like to type...
 
 Could you create a text file of the table
 values and compare those against a
 text files of the possible values? This would
 require O/S level privs.
 
 
 -Original Message-
 From: Steven Haas [mailto:[EMAIL PROTECTED]]
 Sent: Monday, September 23, 2002 11:38 AM
 To: Multiple recipients of list ORACLE-L
 Subject: RE: SQL question
 
 
 Dan (and Charlie),
 
 Thanks.
 Good suggestions, but the IN clause contains
 just
 over 1700 values.
 
 Puzzling, huh?
 
 steve
 
 
 --- Fink, Dan [EMAIL PROTECTED] wrote:
  It is a little awkward, but a union in an
  inline query may do the trick:
  
1  select a.code
2  from (select '10' code from dual union
3select '20' code from dual union
4select '30' code from dual union
5select '40' code from dual union
6select '50' code from dual ) a
7* where a.code not in (select
  to_char(deptno) from emp)
  SQL /
  
  CO
  --
  40
  50
  
  Dan Fink
  
  -Original Message-
  From: Steven Haas
 [mailto:[EMAIL PROTECTED]]
  Sent: Monday, September 23, 2002 10:28 AM
  To: Multiple recipients of list ORACLE-L
  Subject: SQL question
  
  
  Good morning list,
  
  Environment HP-UX 11.0 Oracle 8.1.6
  
  Can anyone help with this SQL.
  
  I can get a result set of values from a table
  that match a given list of values -
  
  select code
  from table
  where code in ('A','B','C','D','E')
  
  I can get a result set of values from a table
  that do not match a given list of values -
  
  select code
  from table
  where code not in ('A','B','C','D','E')
  
  So far so good.
  
  Now, how do I get the set of values from the
  list
  that do NOT have a matching value in the
 table?
  
  I cannot create any objects in the schema I
 am
  working in otherwise I would create a table
  with
  the values and do a minus, but I can't figure
  out
  how to do it in SQL only.
  
  Thanks in advance, folks.
  
  Steve
  -- 
  Please see the official ORACLE-L FAQ:
  http://www.orafaq.com
  -- 
  Author: Steven Haas
INET: [EMAIL PROTECTED]
  
  Fat City Network Services-- 858-538-5051
  http://www.fatcity.com
  San Diego, California-- Mailing list
  and web hosting services
 

-
  To REMOVE yourself from this mailing list,
 send
  an E-Mail message
  to: [EMAIL PROTECTED] (note EXACT spelling
  of 'ListGuru') and in
  the message BODY, include a line containing:
  UNSUB ORACLE-L
  (or the name of mailing list you want to be
  removed from).  You may
  also send the HELP command for other
  information (like subscribing).
 
 -- 
 Please see the official ORACLE-L FAQ:
 http://www.orafaq.com
 -- 
 Author: Steven Haas
   INET: [EMAIL PROTECTED]
 
 Fat City Network Services-- 858-538-5051
 http://www.fatcity.com
 San Diego, California-- Mailing list
 and web hosting services

-
 To REMOVE yourself from this mailing list, send
 an E-Mail message
 to: [EMAIL PROTECTED] (note EXACT spelling
 of 'ListGuru') and in
 the message BODY, include a line containing:
 UNSUB ORACLE-L
 (or the name of mailing list you want to be
 removed from).  You may
 also send the HELP command for other
 information (like subscribing).

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Steven Haas
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: SQL question

2002-09-23 Thread Steven Haas

Raj,

It wasn't a question of coding the sql to create
all of the unions, but hitting a limitation on
the number of unions in the sql.

But, thanks to all for the effort.

steve

--- Jamadagni, Rajendra
[EMAIL PROTECTED] wrote:
 Steve,
 
 select 'select a.code ' || chr(10) || ' from('
 ||
 from dual
 union
 select distinct 'select ' ||  || code ||
  || ' code from dual ' ||
 chr(10) || 'union' ||
   from my_code_table 
 union
 select ')' || chr(10) || 'minus' from dual
 /
 select 'select distinct code from my_table' ||
 chr(10) || '/'
 /
 
 
 drop off the last union before the closing
 parenthesis ...
 
 See ... now you don't have to type ...
 
 Raj

__
 Rajendra JamadagniMIS, ESPN Inc.
 Rajendra dot Jamadagni at ESPN dot com
 Any opinion expressed here is personal and
 doesn't reflect that of ESPN Inc.
 
 QOTD: Any clod can have facts, but having an
 opinion is an art!
 
 
 -Original Message-
 From: Steven Haas [mailto:[EMAIL PROTECTED]]
 Sent: Monday, September 23, 2002 1:38 PM
 To: Multiple recipients of list ORACLE-L
 Subject: RE: SQL question
 
 
 Dan (and Charlie),
 
 Thanks.
 Good suggestions, but the IN clause contains
 just
 over 1700 values.
 
 Puzzling, huh?
 
 steve
 
This
 e-mail message is confidential, intended only
 for the named recipient(s) above and may
 contain information that is privileged,
 attorney work product or exempt from disclosure
 under applicable law. If you have received this
 message in error, or are not the named
 recipient(s), please immediately notify
 corporate MIS at (860) 766-2000 and delete this
 e-mail message from your computer, Thank

you.*2
 

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Steven Haas
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).