Solved

ORACLE 10g -- DECLARE Variable

Posted on 2010-11-22
4
1,495 Views
Last Modified: 2013-12-18
The BELOW ORACLE 10g statement displays "Bind Variable "C1" is NOT DECLARED"
How can I fix ?

declare
 A1 varchar := NULL;
 B1 varchar := NULL;
 C1 varchar := NULL;
begin
 Output_Type_Api.New__(:C1,:B1,:A1,'OUTPUT_TYPE' || CHR(31) || 'xxx' || CHR(30) || 'DESCRIPTION' || CHR(31) || 'xxx' || CHR(30),'DO');
END;
0
Comment
Question by:finance_teacher
4 Comments
 
LVL 5

Accepted Solution

by:
Zopilote earned 125 total points
ID: 34190003
remove the colon
 Output_Type_Api.New__(C1,B1,A1,'OUTPUT_TYPE' || CHR(31) || 'xxx' || CHR(30) || 'DESCRIPTION' || CHR(31) || 'xxx' || CHR(30),'DO');

http://en.wikipedia.org/wiki/PL/SQL
0
 
LVL 14

Assisted Solution

by:ajexpert
ajexpert earned 125 total points
ID: 34190064
Not sure what your package Output_Type_Api.New does

I found that declaration is also not proper

Check declaration section below
declare 

 A1 varchar2(4000) := NULL;

 B1 varchar2(4000) := NULL;

 C1 varchar2(4000) := NULL;

Open in new window

0
 
LVL 28

Assisted Solution

by:Naveen Kumar
Naveen Kumar earned 125 total points
ID: 34193793
A varchar variable cannot be declared without giving the size so give the size as shown in the eaerlier update by ajaexpert and also always use varchar2 instead of varchar even if it works for readability/simplicity as normally varchar2 is the one which should be used.

So try the attached code :

declare
 A1 varchar2(4000) := NULL;
--> change it to anything from 1 to 4000 but you need to ensure that the
-->value you are going to put inside this is not going to exceed the length
-->you have given here. otherwise you end up in value error due to variable
--> overflow.

 B1 varchar2(4000) := NULL;
 C1 varchar2(4000) := NULL;
begin
 Output_Type_Api.New__(C1,B1,A1,'OUTPUT_TYPE' || CHR(31) || 'xxx' || CHR(30) || 'DESCRIPTION' || CHR(31) || 'xxx' || CHR(30),'DO');  
--> also no need of : there as given in update by Zopilote in pl/sql.
END;
/
0
 

Assisted Solution

by:Mitali05
Mitali05 earned 125 total points
ID: 34211106
C1 is a local variable to the block and not a bind variable hence there is no need of column while using it and you need to put size while declaring the varchar variables.
DECLARE
  A1 VARCHAR2(4000) := NULL;
  B1 VARCHAR2(4000) := NULL;
  C1 VARCHAR2(4000) := NULL;
BEGIN
  Output_Type_Api.New__(C1,B1,A1,'OUTPUT_TYPE' || CHR(31) || 'xxx' || CHR(30) || 'DESCRIPTION' || CHR(31) || 'xxx' || CHR(30),'DO');
END;
If still the problem exists there must be some in calling your package Output_Type_Api.New__
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Swadhin
From the Oracle SQL Reference (http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries006.htm) we are told that a join is a query that combines rows from two or more tables, views, or materialized views. This article provides a glimps…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now