Re: querry..
select col1, col2 from table1 where (col1 = 'A' and col2 between 'A' and 'E') or (col1 = 'B' and col2 between 'A' and 'X') Diana Duncan TITAN Technology Partners One Copley Parkway, Ste 540 Morrisville, NC 27560 VM: 919.466.7337 x 316 F: 919.466.7427 E: [EMAIL PROTECTED] "Saurabh Sharma" To: Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]> Fax to: Sent by: Subject: querry.. root@fatcity. com 05/31/2001 04:50 AM Please respond to ORACLE-L hi list, how can i select two columns from a table based on condition that they are selected in specified combinations. let me.. table 1 has 2 columns col1, col2. both cols have values , say, alphabets. a,b,c,d,e,f,... i'want to select like FOR VALUE OF COL1 IN A, col2 must fetch only between A-E for value of col1 in B, col2 must be between A-X -- and so on.. i want to define this combination, so i should get only these pair of values. any suggestions. thanks. saurabh -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: INET: [EMAIL PROTECTED] Fat City Network Services-- (858) 538-5051 FAX: (858) 538-5051 San Diego, California-- Public Internet access / Mailing Lists 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: querry..
hi well, one way to do it is to create a stored function create or replace package pkg_select is function cmb(p1 varchar2, p2 varchar2) return varchar2; end; create or replace package body pkg_select is function cmb(p1 varchar2, p2 varchar2) return varchar2 is begin if p1 = 'A' and instr(p2, 'A|B|C|D|E') >0 then return 'TRUE'; elsif p1 = 'B' and instr(p2, 'A|B|C|D|E|F|G|H|etc...') >0 then return 'TRUE'; else return 'FALSE'; end if; exception when others then return SQLERRM; end cmb; end pkg_select; then do select col1, col2 from table1 where pkg_select.cmb(col1, col2) = 'TRUE'; This keeps your select nice and simple, also you can create a function-based index to give fast performance. Rgds Greg -Original Message-From: Saurabh Sharma [mailto:[EMAIL PROTECTED]]Sent: Thursday, 31 May 2001 09:50To: Multiple recipients of list ORACLE-LSubject: querry.. hi list, how can i select two columns from a table based on condition that they are selected in specified combinations. let me.. table 1 has 2 columns col1, col2. both cols have values , say, alphabets. a,b,c,d,e,f,... i'want to select like FOR VALUE OF COL1 IN A, col2 must fetch only between A-E for value of col1 in B, col2 must be between A-X -- and so on.. i want to define this combination, so i should get only these pair of values. any suggestions. thanks. saurabh
Re: querry..
Hey Saurabh, try using dynamic query as per your requirement. pp. > hi list, > > how can i select two columns from a table based on condition that they are > selected in specified combinations. > > let me.. > table 1 has 2 columns col1, col2. both cols have values , say, alphabets. > a,b,c,d,e,f,... > i'want to select like > > FOR VALUE OF COL1 IN A, col2 must fetch only between A-E > for value of col1 in B, col2 must be between A-X > -- > and so on.. > > i want to define this combination, so i should get only these pair of > values. > > any suggestions. > thanks. > > saurabh > > > > -- > Please see the official ORACLE-L FAQ: http://www.orafaq.com > -- > Author: > INET: [EMAIL PROTECTED] > > Fat City Network Services-- (858) 538-5051 FAX: (858) 538-5051 > San Diego, California-- Public Internet access / Mailing Lists > > 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: Pritam INET: [EMAIL PROTECTED] Fat City Network Services-- (858) 538-5051 FAX: (858) 538-5051 San Diego, California-- Public Internet access / Mailing Lists 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: querry..
Saurabh, If you know your exact conditions and they don't change, you can write a select statement representing each combination and finally have a 'union' of all your sqls. HTH Prakash -Original Message- Sent: Thursday, May 31, 2001 4:50 AM To: Multiple recipients of list ORACLE-L hi list, how can i select two columns from a table based on condition that they are selected in specified combinations. let me.. table 1 has 2 columns col1, col2. both cols have values , say, alphabets. a,b,c,d,e,f,... i'want to select like FOR VALUE OF COL1 IN A, col2 must fetch only between A-E for value of col1 in B, col2 must be between A-X -- and so on.. i want to define this combination, so i should get only these pair of values. any suggestions. thanks. saurabh -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Bala, Prakash INET: [EMAIL PROTECTED] Fat City Network Services-- (858) 538-5051 FAX: (858) 538-5051 San Diego, California-- Public Internet access / Mailing Lists 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: QUERRY DOUBT..
Try this: select d.owner, d.table_name,b.constraint_name,b.constraint_type,d.column_namefrom all_tables a,all_constraints b,all_cons_columns c, all_tab_columns dwhere d.owner = c.owner (+)and d.table_name = c.table_name (+)and d.column_name = c.column_name (+)and c.table_name = a.table_name (+)and c.table_name = b.table_name (+)and c.constraint_name = b.constraint_name(+)and c.owner = a.owner (+)and c.owner = b.owner (+)order by d.owner, d.table_name, d.column_id; HTH Linda -Original Message-From: Saurabh Sharma [mailto:[EMAIL PROTECTED]]Sent: Friday, May 25, 2001 12:46 AMTo: Multiple recipients of list ORACLE-LSubject: QUERRY DOUBT.. hi all, i've a querry that is to find out what all columns have constraints applied on them. giving the table_name,column_name,constraint name and constraint type. the querry goes like.. select a.table_name,b.constraint_name,b.constraint_type,c.column_namefrom user_tables a,user_constraints b,user_cons_columns cwhere a.table_name=b.table_name andb.constraint_name=c.constraint_name/ now i need to make a report which gives out in the same result all the tables' columns which have constraints and which have not, both. leaving the constraint_type and constraint name columns null in the same querry. is it possible, or do we have other alternative to do that. pls suggest. thanks saurabh
Re: QUERRY DOUBT..
THANKS A LOT, Seley the querry works absolutely fine. instead i've created a view. which can be easier to querry. and it also let me able to devise way for finding each individuals' report. thanks again. saurabh sharma - Original Message - From: Seley, Linda To: Multiple recipients of list ORACLE-L Sent: Friday, May 25, 2001 1:51 PM Subject: RE: QUERRY DOUBT.. Try this: select d.owner, d.table_name,b.constraint_name,b.constraint_type,d.column_namefrom all_tables a,all_constraints b,all_cons_columns c, all_tab_columns dwhere d.owner = c.owner (+)and d.table_name = c.table_name (+)and d.column_name = c.column_name (+)and c.table_name = a.table_name (+)and c.table_name = b.table_name (+)and c.constraint_name = b.constraint_name(+)and c.owner = a.owner (+)and c.owner = b.owner (+)order by d.owner, d.table_name, d.column_id; HTH Linda -Original Message-From: Saurabh Sharma [mailto:[EMAIL PROTECTED]]Sent: Friday, May 25, 2001 12:46 AMTo: Multiple recipients of list ORACLE-LSubject: QUERRY DOUBT.. hi all, i've a querry that is to find out what all columns have constraints applied on them. giving the table_name,column_name,constraint name and constraint type. the querry goes like.. select a.table_name,b.constraint_name,b.constraint_type,c.column_namefrom user_tables a,user_constraints b,user_cons_columns cwhere a.table_name=b.table_name andb.constraint_name=c.constraint_name/ now i need to make a report which gives out in the same result all the tables' columns which have constraints and which have not, both. leaving the constraint_type and constraint name columns null in the same querry. is it possible, or do we have other alternative to do that. pls suggest. thanks saurabh