Pl/SQL-statement

2003-11-10 Thread roland . skoldblom
Hallo,

I would like to do the following with an sql( pl/sql) statement.

I have table1 and table2 andtable3.

I want to check whether field1 in table1 exists in table3. If so then I want an insert 
statement to be run...insert into table3.
 If it doesnt find that value then th escript will go to table2 and check if the 
vaules exists in that table, if it finds it then I want another insert statement to be 
run.

Please help me with an easy example, i dont know if this is so simply but I cantget it 
right though.


Thanks


Roland








-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: 
  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: Pl/SQL-statement

2003-11-10 Thread Daniel Fink
RTFM
RTFM
RTFM
RTFM

Do your homework! Read the oracle documents, buy a book from Amazon/Bookpool/Softpro 
and put in a little effort.

If has_done_homework = 'Y'
then
 list_answer = 'Y';
else
  list_answer = 'NO!';
end if;


[EMAIL PROTECTED] wrote:

 Hallo,

 I would like to do the following with an sql( pl/sql) statement.

 I have table1 and table2 andtable3.

 I want to check whether field1 in table1 exists in table3. If so then I want an 
 insert statement to be run...insert into table3.
  If it doesnt find that value then th escript will go to table2 and check if the 
 vaules exists in that table, if it finds it then I want another insert statement to 
 be run.

 Please help me with an easy example, i dont know if this is so simply but I cantget 
 it right though.

 Thanks

 Roland

 --
 Please see the official ORACLE-L FAQ: http://www.orafaq.net
 --
 Author:
   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: Daniel Fink
  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: Pl/SQL-statement

2003-11-10 Thread Thater, William
[EMAIL PROTECTED]  scribbled on the wall in glitter crayon:

 Hallo,
 
 I would like to do the following with an sql( pl/sql) statement.

the answer to your question can be found by reading either the manuals or
any pl/sql book, with examples.  this is the same thing as all the other
questions you've asked for over a year on this list.  you will not make the
effort to learn, we will not make the effort to help.

--
Bill Shrek Thater ORACLE DBA  
I'm going to work my ticket if I can... -- Gilwell song
[EMAIL PROTECTED]

In the beginning I was made.  I didn't ask to be made.  No one consulted me
or considered my feelings in this matter.  But if it brought some passing
fancy to some lowly humans as they haphazardly pranced their way through
life's mournful jungle then so be it.- Marvin the Paranoid Android
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Thater, William
  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: Pl/SQL-statement

2003-11-10 Thread GKatteri

begin
  select 'y' into dummy
   where table3.column = table1.column;
  insert into table3 blah blah;
  exception 
  when no_data_found then
   begin
 select 'y' into dummy
 where table2.column = table1.column;
 insert into table2 blah blah;
   exception
when no_data_found then
 do reqd tasks;
when others then 
 blah blah;
end ;
   when others then
 do reqd tasks;
end;

HTH
GovindanK

On Mon, 10 Nov 2003 06:54:25 -0800, [EMAIL PROTECTED] said:
 Hallo,
 
 I would like to do the following with an sql( pl/sql) statement.
 
 I have table1 and table2 andtable3.
 
 I want to check whether field1 in table1 exists in table3. If so then I
 want an insert statement to be run...insert into table3.
  If it doesnt find that value then th escript will go to table2 and check
  if the vaules exists in that table, if it finds it then I want another
  insert statement to be run.
 
 Please help me with an easy example, i dont know if this is so simply but
 I cantget it right though.
 
 
 Thanks
 
 
 Roland
 
 
 
 
 
 
 
 
 -- 
 Please see the official ORACLE-L FAQ: http://www.orafaq.net
 -- 
 Author: 
   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).

-- 
http://www.fastmail.fm - Email service worth paying for. Try it for free
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: GKatteri
  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: Pl/SQL-statement

2003-11-10 Thread Jonathan Gennick
Hello Roland,

Do you even need PL/SQL for what you want to do?

rsis I want to check whether field1 in table1 exists in
rsis table3. If so then I want an insert statement to be
rsis run...insert into table3

If the field *is* in table 3, you want to insert it into
table 3 again? I find that an odd requirement. However, you
might try something like:

INSERT INTO table3
   SELECT field1
   FROM table1
   WHERE field1 IN (SELECT DISTINCT field1 FROM table3);

EXISTS might work better than IN. You might need to adjust
your SELECT column list to match your target table. I don't
know what other columns are in table3. If table3 is really
large, I'd consider using EXISTS and getting rid of
DISTINCT. Well, you might need to try a few variations to
figure out which performs the best.

Best regards,

Jonathan Gennick --- Brighten the corner where you are
http://Gennick.com * 906.387.1698 * mailto:[EMAIL PROTECTED]

Join the Oracle-article list and receive one
article on Oracle technologies per month by 
email. To join, visit http://four.pairlist.net/mailman/listinfo/oracle-article, 
or send email to [EMAIL PROTECTED] and 
include the word subscribe in either the subject or body.


Monday, November 10, 2003, 9:54:25 AM, [EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote:
rsis Hallo,

rsis I would like to do the following with an sql( pl/sql) statement.

rsis I have table1 and table2 andtable3.

rsis I want to check whether field1 in table1 exists in table3. If so then I want an 
insert statement to be run...insert into table3.
rsis  If it doesnt find that value then th escript will go to table2 and check if the 
vaules exists in that table, if it finds it then I want another insert statement to be 
run.

rsis Please help me with an easy example, i dont know if this is so simply but I 
cantget it right though.


rsis Thanks


rsis Roland








rsis -- 
rsis Please see the official ORACLE-L FAQ: http://www.orafaq.net

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Jonathan Gennick
  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).


PL/SQL statement help

2003-07-24 Thread Milton C. Craighead, Jr.



I'm having no luck resolving the following PL/SQL 
errorsfor afinal examclass project.We do not have access 
to metalinknor do we have access to Oracle PL/SQL documentation. We are 
being taught from a PL/SQL text book that does not provide ora error message 
information or where to findthem...Any and all assistance will be 
greatly appreciated.

1) where am I going wrong

SQL SELECT order#, customer#, address, city, 
state, zip, 2 orderdate, shipdate, shipstreet, shipcity, 
shipstate, 3 shipzip, item#, isbn, quantity 
4 FROM customers NATURAL JOIN orders;shipzip, item#, isbn, 
quantity 
*ERROR at line 3:ORA-00904: "QUANTITY": invalid identifier 

2) I'm trying to format a report where the output 
should look like the following:
 I'm able to format the item#, 
isbn, quanty, retail, and total line with out error but Im getting an error 
message in my veiw...


Order#
Customer#
Customer Address
Customer City, State, Zip

Order Date
Ship Date
Ship Street
Ship City, Ship State, Ship Zip

ITEM# 
ISBN  QUANTY 
 RETAIL TOTAL 
LINE
ITEM#ISBN 
 QUANTY  
RETAIL  TOTAL LINE


SET SERVEROUTPUT ONSQL set linesize 
300SQL set pagesize 20SQL ttitle CENTER 'The Law Report' SKIP 
2SQL btitle '(Confidential)' SKIP 2SQL SQL column item# 
heading 'ITEM#' format a10 truncateSQL column isbn heading 'ISBN' format 
a15 truncateSQL column quantity heading 'QUANTITY' format a6 
truncateSQL column retail heading 'RETAIL' format 990.00SQL 
column total line heading 'TOTAL|LINE' format 990.00SP2-0158: unknown COLUMN 
option "line"SQL SQL Drop view bookPub;

View dropped.

SQL Create view bookPub 2 AS 
select count(b.title) as bookNum, b.cost, b.pubid 3 from 
books b natural join orderitems o 4 group by b.pubid, 
b.cost;

View created.

SQL SQL SQL SQL 
SQL Drop view bookRev;

View dropped.

SQL Create view bookRev 2 
As select count(b.title) as bkNum, sum(b.retail - b.cost) as rev, 
o.customer# 3 from orderitems i natural join books b natural 
join orders o 4 group by o.customer#;

View created.

SQL SQL SQL SQL Drop 
view orderInfo;

View dropped.

SQL Create view orderInfo 
2 As 3 Select c.customer#, o.order#, c.lastname, 
c.firstname, c.address, 4 o.shipdate, o.shipstreet, o.shipcity, 
o.shipstate, 5 o.shipzip, i.item#, i.isbn, i.quantity 
6 from customers c, orders o, orderitems i Where c.customer# = 
o.customer#(+) 7 and o.order# = i.order#;

View created.

SQL SQL CLEAR BREAKbreaks 
clearedSQL CLEAR COLUMNcolumns clearedSQL SQL SELECT 
order#, customer#, address, city, state, zip, 2 orderdate, 
shipdate, shipstreet, shipcity, shipstate, 3 shipzip, 
item#, isbn, quantity 4 FROM customers NATURAL JOIN 
orders;shipzip, item#, isbn, 
quantity 
*ERROR at line 3:ORA-00904: "QUANTITY": invalid identifier 

SQL SQL SELECT item#, isbn, 
quantity, retail, sum(retail*quantity) "Total Line" 2 FROM 
customers NATURAL JOIN orders NATURAL JOIN orderitems 3 
NATURAL JOIN books 4 GROUP BY item#, isbn, quantity, 
retail;
3) last but not least I can not figure out how to 
create this statement at all:

Deletes are not allowed, but you will be allowed to 
de-activate orders. You will need to add a column to the orders table to 

maintain the status, and then only allow updates of 
that colum through a procedure. 

Again thanks for any and all 
assiatance

Regards,Milton C. Craighead, 
Jr.


RE: PL/SQL statement help

2003-07-24 Thread Nelson, Allan
Title: Message



quantity is neither a column name or a valid column alias. That's 
what your error is telling you. 

Allan

  
  -Original Message-From: Milton C. 
  Craighead, Jr. [mailto:[EMAIL PROTECTED] Sent: Thursday, 
  July 24, 2003 11:39 AMTo: Multiple recipients of list 
  ORACLE-LSubject: PL/SQL statement help
  I'm having no luck resolving the following PL/SQL 
  errorsfor afinal examclass project.We do not have 
  access to metalinknor do we have access to Oracle PL/SQL documentation. 
  We are being taught from a PL/SQL text book that does not provide ora error 
  message information or where to findthem...Any and all assistance 
  will be greatly appreciated.
  
  1) where am I going wrong
  
  SQL SELECT order#, customer#, address, city, 
  state, zip, 2 orderdate, shipdate, shipstreet, shipcity, 
  shipstate, 3 shipzip, item#, isbn, quantity 
  4 FROM customers NATURAL JOIN orders;shipzip, item#, isbn, 
  quantity 
  *ERROR at line 3:ORA-00904: "QUANTITY": invalid identifier 
  
  2) I'm trying to format a report where the output 
  should look like the following:
   I'm able to format the item#, 
  isbn, quanty, retail, and total line with out error but Im getting an error 
  message in my veiw...
  
  
  Order#
  Customer#
  Customer Address
  Customer City, State, Zip
  
  Order Date
  Ship Date
  Ship Street
  Ship City, Ship State, Ship Zip
  
  ITEM# 
  ISBN  QUANTY 
   RETAIL TOTAL 
  LINE
  ITEM#ISBN 
   QUANTY  
  RETAIL  TOTAL LINE
  
  
  SET SERVEROUTPUT ONSQL set linesize 
  300SQL set pagesize 20SQL ttitle CENTER 'The Law Report' SKIP 
  2SQL btitle '(Confidential)' SKIP 2SQL SQL column 
  item# heading 'ITEM#' format a10 truncateSQL column isbn heading 
  'ISBN' format a15 truncateSQL column quantity heading 'QUANTITY' 
  format a6 truncateSQL column retail heading 'RETAIL' format 
  990.00SQL column total line heading 'TOTAL|LINE' format 
  990.00SP2-0158: unknown COLUMN option "line"SQL SQL Drop 
  view bookPub;
  
  View dropped.
  
  SQL Create view bookPub 2 AS 
  select count(b.title) as bookNum, b.cost, b.pubid 3 from 
  books b natural join orderitems o 4 group by b.pubid, 
  b.cost;
  
  View created.
  
  SQL SQL SQL SQL 
  SQL Drop view bookRev;
  
  View dropped.
  
  SQL Create view bookRev 
  2 As select count(b.title) as bkNum, sum(b.retail - b.cost) as 
  rev, o.customer# 3 from orderitems i natural join books b 
  natural join orders o 4 group by o.customer#;
  
  View created.
  
  SQL SQL SQL SQL Drop 
  view orderInfo;
  
  View dropped.
  
  SQL Create view orderInfo 
  2 As 3 Select c.customer#, o.order#, c.lastname, 
  c.firstname, c.address, 4 o.shipdate, o.shipstreet, 
  o.shipcity, o.shipstate, 5 o.shipzip, i.item#, i.isbn, 
  i.quantity 6 from customers c, orders o, orderitems i Where 
  c.customer# = o.customer#(+) 7 and o.order# = 
  i.order#;
  
  View created.
  
  SQL SQL CLEAR BREAKbreaks 
  clearedSQL CLEAR COLUMNcolumns clearedSQL SQL 
  SELECT order#, customer#, address, city, state, zip, 2 
  orderdate, shipdate, shipstreet, shipcity, shipstate, 3 
  shipzip, item#, isbn, quantity 4 FROM customers NATURAL JOIN 
  orders;shipzip, item#, isbn, 
  quantity 
  *ERROR at line 3:ORA-00904: "QUANTITY": invalid identifier 
  
  
  SQL SQL SELECT item#, isbn, 
  quantity, retail, sum(retail*quantity) "Total Line" 2 FROM 
  customers NATURAL JOIN orders NATURAL JOIN orderitems 3 
  NATURAL JOIN books 4 GROUP BY item#, isbn, quantity, 
  retail;
  3) last but not least I can not figure out how to 
  create this statement at all:
  
  Deletes are not allowed, but you will be allowed 
  to de-activate orders. You will need to add a column to the orders table to 
  
  maintain the status, and then only allow updates 
  of that colum through a procedure. 
  
  Again thanks for any and all 
  assiatance
  
  Regards,Milton C. Craighead, 
Jr.

__
This email is intended solely for the person or entity to which it is addressed and may contain confidential and/or privileged information.  Copying, forwarding or distributing this message by persons or entities other than the addressee is prohibited. If you have received this email in error, please contact the sender immediately and delete the material from any computer.  This email may have been monitored for policy compliance.  [021216]


Re: PL/SQL statement help

2003-07-24 Thread Joe Testa
Milton, do yourself a favor and sign up for OTN(http://otn.oracle.com) 
you got access to full oracle docs online.

joe

Milton C. Craighead, Jr. wrote:

I'm having no luck resolving the following PL/SQL errors for a final 
exam class project. We do not have access to metalink nor do we have 
access to Oracle PL/SQL documentation. We are being taught from a 
PL/SQL text book that does not provide ora error message information 
or where to find them... Any and all assistance will be greatly 
appreciated. 
 
1) where am I going wrong
 
SQL SELECT order#, customer#, address, city, state, zip,
  2   orderdate, shipdate, shipstreet, shipcity, shipstate,
  3   shipzip, item#, isbn, quantity
  4  FROM customers NATURAL JOIN orders;
 shipzip, item#, isbn, quantity
   *
ERROR at line 3:
ORA-00904: QUANTITY: invalid identifier
2) I'm trying to format a report where the output should look like the 
following:
I'm able to format the item#, isbn, quanty, retail, and total line 
with out error but Im getting an error message in my veiw...
 
 
Order#
Customer#
Customer Address
Customer City, State, Zip
 
Order Date
Ship Date
Ship Street
Ship City, Ship State, Ship Zip
 
ITEM#ISBNQUANTYRETAILTOTAL LINE
ITEM#ISBNQUANTYRETAILTOTAL LINE
 
 
SET SERVEROUTPUT ON
SQL set linesize 300
SQL set pagesize 20
SQL ttitle CENTER 'The Law Report' SKIP 2
SQL btitle '(Confidential)' SKIP 2
SQL
SQL column item# heading 'ITEM#' format a10 truncate
SQL column isbn heading 'ISBN' format a15 truncate
SQL column quantity heading 'QUANTITY' format a6 truncate
SQL column retail heading 'RETAIL' format 990.00
SQL column total line heading 'TOTAL|LINE' format 990.00
SP2-0158: unknown COLUMN option line
SQL
SQL Drop view bookPub;
 
View dropped.
 
SQL Create view bookPub
  2  AS select count(b.title) as bookNum,  b.cost, b.pubid
  3  from books b natural join orderitems o
  4  group by b.pubid, b.cost;
 
View created.
 
SQL
SQL
SQL
SQL
SQL Drop view bookRev;
 
View dropped.
 
SQL Create view  bookRev
  2  As select count(b.title) as bkNum,  sum(b.retail - b.cost) as 
rev, o.customer#
  3  from orderitems i natural join books b natural join orders o
  4  group by o.customer#;
 
View created.
 
SQL
SQL
SQL
SQL Drop view orderInfo;
 
View dropped.
 
SQL Create view  orderInfo
  2  As
  3  Select  c.customer#, o.order#, c.lastname, c.firstname, c.address,
  4  o.shipdate, o.shipstreet, o.shipcity, o.shipstate,
  5  o.shipzip, i.item#, i.isbn, i.quantity
  6  from customers c, orders o, orderitems i Where c.customer# = 
o.customer#(+)
  7  and o.order# = i.order#;
 
View created.
 
SQL
SQL CLEAR BREAK
breaks cleared
SQL CLEAR COLUMN
columns cleared
SQL
SQL SELECT order#, customer#, address, city, state, zip,
  2   orderdate, shipdate, shipstreet, shipcity, shipstate,
  3   shipzip, item#, isbn, quantity
  4  FROM customers NATURAL JOIN orders;
 shipzip, item#, isbn, quantity
   *
ERROR at line 3:
ORA-00904: QUANTITY: invalid identifier
 

SQL
SQL SELECT item#, isbn, quantity, retail, sum(retail*quantity) Total 
Line
  2  FROM customers NATURAL JOIN orders NATURAL JOIN orderitems
  3   NATURAL JOIN books
  4  GROUP BY item#, isbn, quantity, retail;
3) last but not least I can not figure out how to create this 
statement at all:
 
Deletes are not allowed, but you will be allowed to de-activate 
orders. You will need to add a column to the orders table to
maintain the status, and then only allow updates of that colum through 
a procedure.
 
Again thanks for any and all assiatance
 
Regards,
Milton C. Craighead, Jr.


--
Joseph S Testa
Chief Technology Officer 
Data Management Consulting
p: 614-791-9000
f: 614-791-9001

--
Please see the official ORACLE-L FAQ: http://www.orafaq.net
--
Author: Joe Testa
 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: PL/SQL statement help

2003-07-24 Thread Shamita Singh
For the error: SP2-0158: unknown COLUMN option "line", "column total line" must be one word.. no spaces allowed. Can be total_line or just total.

Shamita 

Shamita "Nelson, Allan" [EMAIL PROTECTED] wrote:





quantity is neither a column name or a valid column alias. That's what your error is telling you. 

Allan


-Original Message-From: Milton C. Craighead, Jr. [mailto:[EMAIL PROTECTED] Sent: Thursday, July 24, 2003 11:39 AMTo: Multiple recipients of list ORACLE-LSubject: PL/SQL statement help
I'm having no luck resolving the following PL/SQL errorsfor afinal examclass project.We do not have access to metalinknor do we have access to Oracle PL/SQL documentation. We are being taught from a PL/SQL text book that does not provide ora error message information or where to findthem...Any and all assistance will be greatly appreciated.

1) where am I going wrong

SQL SELECT order#, customer#, address, city, state, zip, 2 orderdate, shipdate, shipstreet, shipcity, shipstate, 3 shipzip, item#, isbn, quantity 4 FROM customers NATURAL JOIN orders;shipzip, item#, isbn, quantity *ERROR at line 3:ORA-00904: "QUANTITY": invalid identifier 
2) I'm trying to format a report where the output should look like the following:
 I'm able to format the item#, isbn, quanty, retail, and total line with out error but Im getting an error message in my veiw...


Order#
Customer#
Customer Address
Customer City, State, Zip

Order Date
Ship Date
Ship Street
Ship City, Ship State, Ship Zip

ITEM# ISBN  QUANTY  RETAIL TOTAL LINE
ITEM#ISBN  QUANTY  RETAIL  TOTAL LINE


SET SERVEROUTPUT ONSQL set linesize 300SQL set pagesize 20SQL ttitle CENTER 'The Law Report' SKIP 2SQL btitle '(Confidential)' SKIP 2SQL SQL column item# heading 'ITEM#' format a10 truncateSQL column isbn heading 'ISBN' format a15 truncateSQL column quantity heading 'QUANTITY' format a6 truncateSQL column retail heading 'RETAIL' format 990.00SQL column total line heading 'TOTAL|LINE' format 990.00SP2-0158: unknown COLUMN option "line"SQL SQL Drop view bookPub;

View dropped.

SQL Create view bookPub 2 AS select count(b.title) as bookNum, b.cost, b.pubid 3 from books b natural join orderitems o 4 group by b.pubid, b.cost;

View created.

SQL SQL SQL SQL SQL Drop view bookRev;

View dropped.

SQL Create view bookRev 2 As select count(b.title) as bkNum, sum(b.retail - b.cost) as rev, o.customer# 3 from orderitems i natural join books b natural join orders o 4 group by o.customer#;

View created.

SQL SQL SQL SQL Drop view orderInfo;

View dropped.

SQL Create view orderInfo 2 As 3 Select c.customer#, o.order#, c.lastname, c.firstname, c.address, 4 o.shipdate, o.shipstreet, o.shipcity, o.shipstate, 5 o.shipzip, i.item#, i.isbn, i.quantity 6 from customers c, orders o, orderitems i Where c.customer# = o.customer#(+) 7 and o.order# = i.order#;

View created.

SQL SQL CLEAR BREAKbreaks clearedSQL CLEAR COLUMNcolumns clearedSQL SQL SELECT order#, customer#, address, city, state, zip, 2 orderdate, shipdate, shipstreet, shipcity, shipstate, 3 shipzip, item#, isbn, quantity 4 FROM customers NATURAL JOIN orders;shipzip, item#, isbn, quantity *ERROR at line 3:ORA-00904: "QUANTITY": invalid identifier 

SQL SQL SELECT item#, isbn, quantity, retail, sum(retail*quantity) "Total Line" 2 FROM customers NATURAL JOIN orders NATURAL JOIN orderitems 3 NATURAL JOIN books 4 GROUP BY item#, isbn, quantity, retail;
3) last but not least I can not figure out how to create this statement at all:

Deletes are not allowed, but you will be allowed to de-activate orders. You will need to add a column to the orders table to 
maintain the status, and then only allow updates of that colum through a procedure. 

Again thanks for any and all assiatance

Regards,Milton C. Craighead, Jr.
__This email is intended solely for the person or entity to which it is addressed and may contain confidential and/or privileged information. Copying, forwarding or distributing this message by persons or entities other than the addressee is prohibited. If you have received this email in error, please contact the sender immediately and delete the material from any computer. This email may have been monitored for policy compliance. [021216]Shamita
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software

pl/sql statement

2002-04-08 Thread Farnsworth, Dave

How can I do something like this;

select count(*) from prod.consenid into usercnt_tmp from dual

I want to send the amount of COUNT(*) into a variable.  I get the following error

ORA-06550: line 5, column 36:
PLS-00103: Encountered the symbol INTO when expecting one of the following:
. , @ ; for an identifier
a double-quoted delimited-identifier group having intersect
minus order start union where connect
ORA-06550: line 6, column 1:
PLS-00103: Encountered the symbol END

Is this something that I can do.  I am probably overlooking something very obvious.

Thanks,

Dave
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Farnsworth, Dave
  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: pl/sql statement

2002-04-08 Thread Jamadagni, Rajendra

select count(*)
  into usercnt_tmp
  from prod.consenid;

Raj
__
Rajendra Jamadagni  MIS, 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!


***1

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 ESPN at (860) 766-2000 and 
delete this e-mail message from your computer, Thank you.

***1



RE: pl/sql statement

2002-04-08 Thread Pardee, Roy E

If you've declared the variable usercnt_tmp, then you should be fine if you
just leave out the  from dual bit and re-order the statements, e.g.,

   select  count(*)
   intousercnt_tmp
   fromprod.consenid ;

hth,

-Roy

Roy Pardee
Programmer/Analyst
SWFPAC Lockheed Martin IT
Extension 8487

-Original Message-
Sent: Monday, April 08, 2002 9:57 AM
To: Multiple recipients of list ORACLE-L


How can I do something like this;

select count(*) from prod.consenid into usercnt_tmp from dual

I want to send the amount of COUNT(*) into a variable.  I get the following
error

ORA-06550: line 5, column 36:
PLS-00103: Encountered the symbol INTO when expecting one of the
following:
. , @ ; for an identifier
a double-quoted delimited-identifier group having intersect
minus order start union where connect
ORA-06550: line 6, column 1:
PLS-00103: Encountered the symbol END

Is this something that I can do.  I am probably overlooking something very
obvious.

Thanks,

Dave
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Farnsworth, Dave
  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: Pardee, Roy E
  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).