If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > sqlj help

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-19-03, 13:46
zinny03 zinny03 is offline
Registered User
 
Join Date: Jul 2003
Posts: 5
sqlj help

I want to write a sqlj program that will prompt the user for an old zipcode value and a new zip values and that will change all occurrences of the old zipcode value in the tables of the mail database to the new zipcode value. I have figured out the code for pl/sql, but I don't know how to go about putting it in sqlj. Here is what I have so far:


ACCEPT oldZip PROMPT 'Enter old zipcode: '
ACCEPT newZip PROMPT 'Enter new zipcode: '

declare

aCity ZIPCODES.CITY%TYPE;

begin
select CITY into aCity from ZIPCODES where ZIP = &oldZip;

insert into ZIPCODES values(&newZip, aCity);

update CUSTOMERS set ZIP = &newZip
where ZIP = &oldZip;
update EMPLOYEES set ZIP = &newZip
where ZIP = &oldZip;

delete from ZIPCODES where ZIP = &oldZip;
end;
/
Reply With Quote
  #2 (permalink)  
Old 07-19-03, 17:30
Xenia1129 Xenia1129 is offline
Registered User
 
Join Date: Jul 2003
Posts: 2
Re: sqlj help

You must take CSC452 coure, right? I got the same problem
Reply With Quote
  #3 (permalink)  
Old 07-19-03, 18:26
izy izy is offline
Registered User
 
Join Date: Jul 2003
Posts: 10
yes. what all are you having problems with? how is everything coming with you?
Reply With Quote
  #4 (permalink)  
Old 07-19-03, 19:05
Xenia1129 Xenia1129 is offline
Registered User
 
Join Date: Jul 2003
Posts: 2
Hi,
So bad, I did not actually finish any question of these three. I did part of Q1
&& Q3. How about you.
Reply With Quote
  #5 (permalink)  
Old 07-19-03, 21:58
izy izy is offline
Registered User
 
Join Date: Jul 2003
Posts: 10
I'm having sooo much trouble with this. For me, pl/sql is not really a problem, but the sqlj is. What did you come up with num1 and num3?

Quote:
Originally posted by Xenia1129
Hi,
So bad, I did not actually finish any question of these three. I did part of Q1
&& Q3. How about you.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On