Solved

ORACLE 10g -- DECLARE Variable

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

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Oracle Pivot Question 8 71
SQL Query 34 116
Oracle dataguard 5 46
update using pipeline function 3 21
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

828 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