I am hoping that someone would be able to help me with my code.
-- This code is supposed to check the database Pages (pname, exit_count(number), entry_count(number)) if a website ('p01') already exists.
-- If the website does exist the code is supposed to return a DBMS message.
--If it does not exist then the website should be added with the pname, exit_count = 0, entry_count = 0.
--The problem is that once I add one website // exec add_pages('p01'); // if I try to add another // exec add_pages('p02'); // I get my DBMS message instead of it adding the website to Pages database.
--Any help or suggestions would be greatly appreciated.
--The code has to be in this following format as it is for a school project.
set serveroutput on size 1000000 format wrap
create or replace procedure add_pages (
pname in pages.pname%type)
as
page_name number;
begin
select count(*) into page_name from pages
where pages.pname = pname;
if
page_name > 0 then
dbms_output.put_line('This Website Already Exists!');
else
insert into pages values(pname, 0, 0);
end if;
end;
/
SELECT * FROM PAGES ORDER BY PNAMEjust to be certain that you know what exists in the PAGES table before you start. Best of luck.