?
Solved

ORACLE 10g -- DECLARE Variable

Posted on 2010-11-22
4
Medium Priority
?
1,511 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 500 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 500 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 500 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 500 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.
Suggested Courses

777 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