Re: query problem

2002-08-16 Thread Don Jerman

how about

select  tab1.id from tab1,tab2 where tab1.id=tab2.id group by tab1.id having 
sum(decode(tab2.status,'Y',1,'N',-1,0)) > 0;

Harvinder Singh wrote:

> Hi,
>
> we have 2 tables tab1 and tab2 each having id column and tab2 also has column status 
>that will contain value 'Y' or 'N'
> for particular id and tab2 has many records for particular id
> we need to select distinct id from join of these 2 tables where status in tab2 has 
>more 'Y' than 'N'
>
> Thanks
> --Harvinder
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: Harvinder Singh
>   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).


begin:vcard 
n:Jerman;Don
tel;work:919.508.1886
x-mozilla-html:TRUE
org:Database Management Service,Information Technology
version:2.1
email;internet:[EMAIL PROTECTED]
title:Database Administrator
adr;quoted-printable:;;Database Management Service,Information Technology=0D=0A104 Fayetteville Street Mall;Raleigh;NC;27699-1521;USA
x-mozilla-cpt:;-9536
fn:Don Jerman
end:vcard



RE: QUERY PROBLEM

2001-10-19 Thread Jacques Kilchoer
Title: RE: QUERY PROBLEM





> -Original Message-
> From: Harvinder Singh [mailto:[EMAIL PROTECTED]]
> 
> We need to write a query like this:
> 
> declare
> dd number;
> begin
> select * from t_acc where id_acc=dd;
> end;
> /


Get the result back to where? What kind of client application? Is the query returning only one row or multiple rows?


Here are two ways of doing it in SQL*Plus:


SQL> define def_var = "X"
SQL> select * from dual where dummy = '&def_var' ;
ancien   1 : select * from dual where dummy = '&def_var'
nouveau   1 : select * from dual where dummy = 'X'


D
-
X


SQL> variable bind_var varchar2 (1)
SQL> execute :bind_var := 'X'


Procédure PL/SQL terminée avec succès.


SQL> select * from dual where dummy = :bind_var ;


D
-
X





Re: QUERY PROBLEM

2001-10-19 Thread Shishir

Sorry to ask u . DO u want ot to get recordset in ur application 

Shishir Kumar Mishra
Email :[EMAIL PROTECTED]
--



- Original Message - 
To: "Multiple recipients of list ORACLE-L" <[EMAIL PROTECTED]>
Sent: Saturday, October 20, 2001 12:05 AM


> we want query to retun result set back to application...
> 
> -Original Message-
> Sent: Friday, October 19, 2001 2:03 PM
> To: Multiple recipients of list ORACLE-L
> 
> 
> It depends on what you want to do with this.  You need to have an into
> clause, so declare a variable and put one in.  If you want to see the
> output, then use the dbms_ouput package to display it.
> 
> Harvinder Singh wrote:
> > 
> > Hi,
> > 
> > We need to write a query like this:
> > 
> > declare
> > dd number;
> > begin
> > select * from t_acc where id_acc=dd;
> > end;
> > /
> > 
> > we r getting obvious error that INTO clause is missing
> > but we only need to run the query and get the result back.
> > How can we accomplish this.
> > 
> > Thanks
> > -Harvinder
> > --
> > Please see the official ORACLE-L FAQ: http://www.orafaq.com
> > --
> > Author: Harvinder Singh
> >   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).
> 
> -- 
> Scott Canaan ([EMAIL PROTECTED])
> (716) 475-7886
> "Life is like a sewer, what you get out of it depends on what you put
> into it" - Tom Lehrer
> -- 
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> -- 
> Author: Scott Canaan
>   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: Harvinder Singh
>   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: Shishir
  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: QUERY PROBLEM

2001-10-19 Thread Harvinder Singh

we want query to retun result set back to application...

-Original Message-
Sent: Friday, October 19, 2001 2:03 PM
To: Multiple recipients of list ORACLE-L


It depends on what you want to do with this.  You need to have an into
clause, so declare a variable and put one in.  If you want to see the
output, then use the dbms_ouput package to display it.

Harvinder Singh wrote:
> 
> Hi,
> 
> We need to write a query like this:
> 
> declare
> dd number;
> begin
> select * from t_acc where id_acc=dd;
> end;
> /
> 
> we r getting obvious error that INTO clause is missing
> but we only need to run the query and get the result back.
> How can we accomplish this.
> 
> Thanks
> -Harvinder
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: Harvinder Singh
>   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).

-- 
Scott Canaan ([EMAIL PROTECTED])
(716) 475-7886
"Life is like a sewer, what you get out of it depends on what you put
into it" - Tom Lehrer
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Scott Canaan
  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: Harvinder Singh
  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: QUERY PROBLEM

2001-10-19 Thread Harvinder Singh

Actullay it sql server u can do like this inside the block:

declare @@dd int
select * from t_acc where id_acc=@@dd

AND now developer wants something similar in Oracle...



-Original Message-
Sent: Friday, October 19, 2001 2:03 PM
To: Multiple recipients of list ORACLE-L


It depends on what you want to do with this.  You need to have an into
clause, so declare a variable and put one in.  If you want to see the
output, then use the dbms_ouput package to display it.

Harvinder Singh wrote:
> 
> Hi,
> 
> We need to write a query like this:
> 
> declare
> dd number;
> begin
> select * from t_acc where id_acc=dd;
> end;
> /
> 
> we r getting obvious error that INTO clause is missing
> but we only need to run the query and get the result back.
> How can we accomplish this.
> 
> Thanks
> -Harvinder
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: Harvinder Singh
>   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).

-- 
Scott Canaan ([EMAIL PROTECTED])
(716) 475-7886
"Life is like a sewer, what you get out of it depends on what you put
into it" - Tom Lehrer
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Scott Canaan
  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: Harvinder Singh
  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: QUERY PROBLEM

2001-10-19 Thread Deepak Thapliyal

i think he wants to query based on a varaible in the
where clause and probably needs top know how that is
done is sql*plus (and not pl/sql)

i gues there is a accept/define commands whihc you
could use .. 

hth
Deepak

PS;i am lame myself in sql*plus...


--- Scott Canaan <[EMAIL PROTECTED]> wrote:
> It depends on what you want to do with this.  You
> need to have an into
> clause, so declare a variable and put one in.  If
> you want to see the
> output, then use the dbms_ouput package to display
> it.
> 
> Harvinder Singh wrote:
> > 
> > Hi,
> > 
> > We need to write a query like this:
> > 
> > declare
> > dd number;
> > begin
> > select * from t_acc where id_acc=dd;
> > end;
> > /
> > 
> > we r getting obvious error that INTO clause is
> missing
> > but we only need to run the query and get the
> result back.
> > How can we accomplish this.
> > 
> > Thanks
> > -Harvinder
> > --
> > Please see the official ORACLE-L FAQ:
> http://www.orafaq.com
> > --
> > Author: Harvinder Singh
> >   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).
> 
> -- 
> Scott Canaan ([EMAIL PROTECTED])
> (716) 475-7886
> "Life is like a sewer, what you get out of it
> depends on what you put
> into it" - Tom Lehrer
> -- 
> Please see the official ORACLE-L FAQ:
> http://www.orafaq.com
> -- 
> Author: Scott Canaan
>   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).


__
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Deepak Thapliyal
  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: QUERY PROBLEM

2001-10-19 Thread Scott Canaan

It depends on what you want to do with this.  You need to have an into
clause, so declare a variable and put one in.  If you want to see the
output, then use the dbms_ouput package to display it.

Harvinder Singh wrote:
> 
> Hi,
> 
> We need to write a query like this:
> 
> declare
> dd number;
> begin
> select * from t_acc where id_acc=dd;
> end;
> /
> 
> we r getting obvious error that INTO clause is missing
> but we only need to run the query and get the result back.
> How can we accomplish this.
> 
> Thanks
> -Harvinder
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: Harvinder Singh
>   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).

-- 
Scott Canaan ([EMAIL PROTECTED])
(716) 475-7886
"Life is like a sewer, what you get out of it depends on what you put
into it" - Tom Lehrer
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Scott Canaan
  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: query problem

2001-09-11 Thread Mark Leith

Or set define off..

-Original Message-
Sent: Monday, September 10, 2001 21:56
To: Multiple recipients of list ORACLE-L


or ..

If you are doing it in SQLPLUS you can do 

set scan off

That way it will not look for & variables.

-Original Message-
Sent: Monday, September 10, 2001 3:31 PM
To: Multiple recipients of list ORACLE-L


Hi,

I need to run the follwing query:

select * from t_enum_data where id_enum_data ='metrr/usa & canada';

and it is always prompt for value of canada as there is & sign..
how to supress for prompt and use & as constant

Thanks
-harvinder
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Harvinder Singh
  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: Kevin Lange
  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: Mark Leith
  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: query problem

2001-09-10 Thread Kevin Lange

or ..

If you are doing it in SQLPLUS you can do 

set scan off

That way it will not look for & variables.

-Original Message-
Sent: Monday, September 10, 2001 3:31 PM
To: Multiple recipients of list ORACLE-L


Hi,

I need to run the follwing query:

select * from t_enum_data where id_enum_data ='metrr/usa & canada';

and it is always prompt for value of canada as there is & sign..
how to supress for prompt and use & as constant

Thanks
-harvinder
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Harvinder Singh
  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: Kevin Lange
  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: query problem

2001-09-10 Thread Kevin Lange

you could always change it to 

select * from t_enum_data where id_enum_data ='metrr/usa '||chr(38)||'
canada';


-Original Message-
Sent: Monday, September 10, 2001 3:31 PM
To: Multiple recipients of list ORACLE-L


Hi,

I need to run the follwing query:

select * from t_enum_data where id_enum_data ='metrr/usa & canada';

and it is always prompt for value of canada as there is & sign..
how to supress for prompt and use & as constant

Thanks
-harvinder
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Harvinder Singh
  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: Kevin Lange
  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).