Solved

ORACLE 10g -- DECLARE Variable

Posted on 2010-11-22
4
1,491 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

747 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

13 Experts available now in Live!

Get 1:1 Help Now