Solved

ORACLE 10g -- DECLARE Variable

Posted on 2010-11-22
4
1,507 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
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.

731 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