Home » SQL & PL/SQL » SQL & PL/SQL » Bind variable "COUNT" not declared.
Bind variable "COUNT" not declared. [message #39912] Thu, 22 August 2002 14:27 Go to next message
Jason Peterson
Messages: 3
Registered: August 2002
Junior Member
I'm having quite a time with this code. I know it's simple but I can't figure out what I'm missing. Here is my code.

DECLARE
v_id VARCHAR2(10) := 'JJOHNSON';
v_passwd VARCHAR2(10) := 'nopassword';
v_oid VARCHAR2(5) := 'TEC01';
v_fname VARCHAR2(20) := 'Jack';
v_lname VARCHAR2(20) := 'Johnson';
v_authlevel NUMBER := '1';
var count CHAR;
BEGIN
UPDATE webusers
SET userid = v_id, password = v_passwd
WHERE first = v_fname
AND last = v_lname;

IF SQL%NOTFOUND THEN
INSERT INTO webusers ( userid, password, o_id, first, last, authlevel )
VALUES ( v_id, v_passwd, v_oid, v_fname, v_lname, v_authlevel );
ELSE
SELECT count(*) INTO :count FROM webusers;
END IF;

END;
/

When I runt the procedure, I get the following error:
SP2-0552: Bind variable "COUNT" not declared.
Re: Bind variable "COUNT" not declared. [message #39913 is a reply to message #39912] Thu, 22 August 2002 15:39 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
First off, the line:

var count CHAR;


should be:

count  pls_integer;


And the SELECT/INTO statement does not need the colon (:) in front of the variable count.
Previous Topic: bind variable GENCR not declared
Next Topic: New Column based on Logical Test
Goto Forum:
  


Current Time: Wed Apr 24 05:18:35 CDT 2024