Basically I have an exam coming up in Database Design, and one of our main topics is embedded SQL. This is the only example I was given, however with 0 explanation I pretty much have a hard time trying to figure out what is going on, if I knew what language it was written in I could atleast find a reference manual for help.
var
StaffNum: string[5];
FirstName, LastName: string[12];
Address: string [60];
Telephone: string[12];
EXEC SQL
INCLUDE SQLCA
END EXEC
begin
EXEC SQL
LOGIN localhost, 'scott' , 'tiger'
END EXEC
if SQLCODE <> 0 then
begin
display ('Illegal login attempted - program terminating');
exit
end;
display ('Enter Staff Number of Interest');
accept (StaffNum);
EXEC SQL
SELECT Fname, Lname, Address, Tel_No
INTO :FirstName, :LastName, :Address, :Telephone
FROM STAFF
WHERE Sno = :StaffNum
END EXEC
if SQLCODE <> 0 then
begin
display ('Invalid Staff Number Entered: ', StaffNum)
end
else
begin
display ('Name: ', FirstName, ' ', LastName);
display ('Home Address: ', Address);
display ('Phone Number: ', Telephone)
end;
EXEC SQL
LOGOFF
END EXEC
end.
Any idea would be greatly appreciated!
Edit: I know what the general program does, but questions that come up are along the lines of "what is the 'Include' used for, or what are the possible values for SQLCODE etc.