Home » SQL & PL/SQL » SQL & PL/SQL » Oracle example does not work - need clues why
Oracle example does not work - need clues why [message #41288] Sat, 14 December 2002 01:21 Go to next message
leza
Messages: 1
Registered: December 2002
Junior Member
In testing in class the Bank Account Oracle example for object types (using 9.0.1), I found that it throws an error in 2 lines. I have similar problems with my code which is why I tested Oracle's. # Neither one of my professors can find the reason. So thought I'd ask here.

The specific code is:
MEMBER PROCEDURE withdraw (num IN INTEGER, amount IN REAL) IS
-- if account has enough funds, withdraw
-- given amount; else, raise an exception
BEGIN
verify_acct(num); --ERROR HERE
IF amount <= balance THEN
balance := balance - amount;--ERROR HERE
ELSE
RAISE_APPLICATION_ERROR(-20107, 'insufficient funds');
END IF;
END withdraw;

The error is:
PLS-00363 expression 'string' cannot be used as an assignment target
The problem with verify_acct doesn't seem to be with its code (One prof tested by substituting the guts with NULL).
I'd greatly appreciate the help.
Re: Oracle example does not work - need clues why [message #41295 is a reply to message #41288] Mon, 16 December 2002 06:34 Go to previous message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
1. 
[i]verify_acct(num); [/i]
i beleive, verify_acct is a function or procedure.
Check out the IN/OUT/IN OUT PARAMETERS.
2.
[i]balance := balance - amount;--ERROR HERE[/i]
you have not declared variable balance 
anywhere inside your procedure

Previous Topic: SQL to PL/SQL
Next Topic: Difference between........
Goto Forum:
  


Current Time: Thu May 16 06:55:23 CDT 2024