| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.tools -> PL/SQL: What is wrong with the INSERT in this PL/SQL program?
Hello, just started learning PL/SQL (and I'm a complete novice at SQL).
Consider the following script:
$ cat withdraw_or_deposit.sql
-- Insert into database by issuing:
CREATE OR REPLACE PROCEDURE
withdraw_or_deposit(accnum IN INTEGER, amount IN INTEGER, empnum IN
INTEGER)
IS
num_acc INTEGER := 0;
num_emp INTEGER := 0;
BEGIN
SELECT COUNT(account_number)
INTO num_acc
FROM account
WHERE accnum=account.account_number;
IF num_acc = 0 THEN
raise_application_error(
-20000,
'Error - ' || accnum || ' is an invalid account number.'
);
INTO num_emp
FROM employee
WHERE empnum=employee.key;
IF num_emp = 0 THEN
raise_application_error(
-20000,
'Error - there is no employee with the key ' || empnum || '.'
);
The compilation fails, show errors yields: SQL> show errors
Errors for PROCEDURE WITHDRAW_OR_DEPOSIT:
LINE/COL ERROR
33/4 PL/SQL: SQL Statement ignored
34/14 PLS-00201: identifier 'TRANSACTION_SEQ.NEXTVAL' must be declared
If I comment out the INSERT it compiles cleanly...so what's wrong with the INSERT? I'm guessing it has to do with sysdate...what can I do to fix this?
/ E Received on Mon Apr 03 2006 - 15:38:51 CDT
![]() |
![]() |