473,569 Members | 2,788 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SQL0440N error in Stored Procedure...... ..

1 New Member
Hi,

I am new to DB2. I am trying to write a simple stored procedure, but getting the error attached below.

ERROR
=============== =============== =============== =============
TGT.AUDIT - Build started.
Create stored procedure returns -440.
TGT.AUDIT: 28: [IBM][CLI Driver][DB2/NT] SQL0440N No authorized routine named "||" of type "FUNCTION" having compatible arguments was found. LINE NUMBER=28. SQLSTATE=42884


TGT.AUDIT - Build failed.
TGT.AUDIT - Roll back completed successfully.

=============== =============== =============== =============

Attched below is the code which I have written. The error statement is marked as *. Can anyone please help me out....

Thanks in Adv.

Girish Dalvi



CREATE PROCEDURE TGT.AUDIT (IN V_TAB_NAME VARCHAR(10) )
------------------------------------------------------------------------
-- SQL Stored Procedure
------------------------------------------------------------------------
dl: BEGIN
DECLARE v_tbl_name varchar(10);
DECLARE I int default 0;
DECLARE v_col_count int;
DECLARE v_col_name varchar(10);
DECLARE v_total INT;
DECLARE v_col varchar(10);
DECLARE SQLSTRING varchar(4000);
DECLARE V_STMT STATEMENT;




DECLARE cur_col_name cursor for select colname from metadata where tname=V_TAB_NAM E;


select count(*) into v_col_count from metadata where tname=V_TAB_NAM E;
insert into tmp values ('the new value is ',v_col_count);
open cur_col_name;

while I < v_col_count
do
fetch cur_col_name into v_col_name;
* SET SQLSTRING = 'SELECT sum(cast('|| v_col_name || ')) into' ||v_total|| ' from ' || V_TAB_NAME;
PREPARE V_STMT FROM SQLSTRING;
Insert into TOTALS values (V_TAB_NAME,v_c ol_name, v_total);
set I=I+1;
end while;
close cur_col_name;

END dl
Jun 15 '06 #1
2 5119
sylvie36
4 New Member
Hello,

When you see the error message you have the number of the line which is not ok. It's the 28's one so it's the next one :

And the message is sample. You can't used || has an argument so you need employed quotes ' ' for puting it as commantary and not as a type of argument of the function V_TAB_NAME

* SET SQLSTRING = 'SELECT sum(cast('|| v_col_name || ')) into' ||v_total|| ' from ' || V_TAB_NAME

To my mind you must trying by put some another quotes as after in your line as next :

* SET SQLSTRING = 'SELECT sum(cast('|| v_col_name || ')) into' ||v_total|| ' from ' '||' V_TAB_NAME

Good luck

If you need more explication I'm trying to help you

Bye



Hi,

I am new to DB2. I am trying to write a simple stored procedure, but getting the error attached below.

ERROR
=============== =============== =============== =============
TGT.AUDIT - Build started.
Create stored procedure returns -440.
TGT.AUDIT: 28: [IBM][CLI Driver][DB2/NT] SQL0440N No authorized routine named "||" of type "FUNCTION" having compatible arguments was found. LINE NUMBER=28. SQLSTATE=42884


TGT.AUDIT - Build failed.
TGT.AUDIT - Roll back completed successfully.

=============== =============== =============== =============

Attched below is the code which I have written. The error statement is marked as *. Can anyone please help me out....

Thanks in Adv.

Girish Dalvi



CREATE PROCEDURE TGT.AUDIT (IN V_TAB_NAME VARCHAR(10) )
------------------------------------------------------------------------
-- SQL Stored Procedure
------------------------------------------------------------------------
dl: BEGIN
DECLARE v_tbl_name varchar(10);
DECLARE I int default 0;
DECLARE v_col_count int;
DECLARE v_col_name varchar(10);
DECLARE v_total INT;
DECLARE v_col varchar(10);
DECLARE SQLSTRING varchar(4000);
DECLARE V_STMT STATEMENT;




DECLARE cur_col_name cursor for select colname from metadata where tname=V_TAB_NAM E;


select count(*) into v_col_count from metadata where tname=V_TAB_NAM E;
insert into tmp values ('the new value is ',v_col_count);
open cur_col_name;

while I < v_col_count
do
fetch cur_col_name into v_col_name;
* SET SQLSTRING = 'SELECT sum(cast('|| v_col_name || ')) into' ||v_total|| ' from ' || V_TAB_NAME;
PREPARE V_STMT FROM SQLSTRING;
Insert into TOTALS values (V_TAB_NAME,v_c ol_name, v_total);
set I=I+1;
end while;
close cur_col_name;

END dl
Jul 24 '06 #2
sylvie36
4 New Member
Hello,
To my mind you can try to add some quotes to the line 28 which is the line on error as next :
* SET SQLSTRING = 'SELECT sum(cast('|| v_col_name || ')) into' ||v_total|| ' from ' '||' V_TAB_NAME
Because if you don't put quotes || is a type of argument for the function V_TAB_NAME which isn't the case.

Good luck

Bye
Jul 24 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
9552
by: shyner | last post by:
Hi Everyone, I've been battling this for two days with no luck. I'm using SQL Server 2000. Here's the mystery: I've got a stored procedure that takes a single varchar parameter to determine how the result set is sorted. Here it is: CREATE PROCEDURE spDemo @SortField varchar(30)
1
4328
by: Jen S | last post by:
I feel like I'm missing something obvious here, but I'm stumped... I have a stored procedure with code that looks like: INSERT INTO MyTableA ( ...fields... ) VALUES (...values...) IF (@@ERROR <> 0) BEGIN ROLLBACK TRANSACTION; RAISERROR('An error occurred in the stored proc.', 16, 1);
0
4262
by: Rhino | last post by:
I've written several Java stored procedures now (DB2 V7.2) and I'd like to write down a few "best practices" for reference so that I will have them handy for future development. Would the experts here agree with the following? Would they add any other points? 1. If the shop standard calls for logging of application errors, a stored...
4
16689
by: shalini | last post by:
All, we are trying to create and execute our stored procs on db2 ver 8.1 fp5. This is a new database that we setup and are having some trouble. When I try and run the stored proc from the db2 command line, I get the following error: SQL0440N No authorized routine named "XXX" of type "PROCEDURE" having compatible arguments was found. ...
1
2562
by: Mihaly | last post by:
I have a stored procedure in SQL Server 2000, and I want to read the error messages from this stored procedure. Please help me for this question: This is the stored procedure. Please supose than Column2 has no 0 values: CREATE PROCEDURE dbo.ErrorTest AS SELECT Column1 FROM Table WHERE Column2 = 0 IF (@@ROWCOUNT <= 0) GOTO RollB
4
6695
by: Jack | last post by:
Hi, I am trying to run an example code from a book. However I am getting the following error message: Number: -2147217900 Description: Syntax error or access violation Source: Microsoft OLE DB Provider for SQL Server SQLState: 42000
1
3069
by: MenakaMeena | last post by:
Hi while trying to invoke the stored procedure in DB2 from java i get the following error in log. Can u plz help me? sql0440N. No authorized routine named "XXX" of type having compatible arguments was found. SQLSTATE=42884. Thanks
4
5069
by: barmatt80 | last post by:
I am stumped on the error reporting with sql server. I was told i need to return @SQLCode(code showing if successful or not) and @ErrMsg(and the message returned). I am clueless on this. I wrote this procedure: ALTER PROCEDURE . @Emp_SSN int, @Annual_Forward decimal(10,2),
0
1999
by: preejith | last post by:
I am getting the following error while running a stored procedure in mysql5.0 Error Code : 1329 No data - zero rows fetched, selected, or processed. I have an stored procedure SP1 which calls stored procedure SP2 and SP2 calls a function F1. I have run this script from .bat file. after executing i tried to call stored procedure 1...
0
7697
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8120
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7968
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6283
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5512
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1212
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.