|
-
CREATE OR REPLACE PROCEDURE parcel_t1
(
p_CityID ttt.CITY_ID%TYPE,
p_StreetName ttt.STREET_NAME%TYPE
) AS
declare
cursor co is
SELECT CITY_ID,STREET_NAME
FROM tttt
WHERE CITY_ID = 'TC' ;
-- Why did you hardcode the city_id. Logically, it should
-- have been p_cityid... Am I right ?
-- for instance it could have been
-- cursor co is
-- select city_id,street_name
-- from ttt
-- where city_id = p_city_id
-- and street_name = p_streetname;
Begin
for i in co
loop
-- Insert a new row in the parcel_t1 table
INSERT INTO parcel_t1 (CityID, Street_Name)
VALUES (i.CITY_ID, i.STREET_NAME));
end loop;
COMMIT;
END parcel_t1;
/
-- Note
-- Do not forget to put '/' since it will tell SQL*PLUS to execute the script and hence compile the procedure. In case you have errors, use the following command
To view one line, say line 4 use the command
< line 1,10> , it will display first 10 lines. It is easier to find the errors this way since error at line 4 may be due to the fact the line 3 was incomplete
Hope this will help
Ally
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|