473,320 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Cursor

hi,

While creating following UDF I am getting an error (I have removed the
some statements).

CREATE FUNCTION CONVERTROW(VAR1 VARCHAR(50))
RETURNS VARCHAR(205)
DETERMINISTIC NO EXTERNAL ACTION
CONTAINS SQL
LANGUAGE SQL
BEGIN ATOMIC

DECLARE C1 CURSOR FOR
SELECT COL FROM SURI;

RETURN RESULT;
END
@
error messages is :
SQL0104N An unexpected token "FOR" was found following "C DECLARE C1
CURSOR". Expected tokens may include: "<SQL_variable_declarations>".
LINE
NUMBER=8. SQLSTATE=42601

thanks in advance,
Suresh D
Nov 12 '05 #1
2 1753
Suresh D wrote:
hi,

While creating following UDF I am getting an error (I have removed the
some statements).

CREATE FUNCTION CONVERTROW(VAR1 VARCHAR(50))
RETURNS VARCHAR(205)
DETERMINISTIC NO EXTERNAL ACTION
CONTAINS SQL
LANGUAGE SQL
BEGIN ATOMIC

DECLARE C1 CURSOR FOR
SELECT COL FROM SURI;

RETURN RESULT;
END
@
error messages is :
SQL0104N An unexpected token "FOR" was found following "C DECLARE C1
CURSOR". Expected tokens may include: "<SQL_variable_declarations>".
LINE
NUMBER=8. SQLSTATE=42601

thanks in advance,
Suresh D

inline SQL PL does not support cursors (see the compound statement
(dynamic) definition in teh SQL Ref.
Instead use a FOR loop (which I find much nicer, btw).

Cheers
Serge

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #2
Looks like the cursor declaration in functions is not supported(
correct me if I am wrong). Instead u can update your function by the
following statements or u can use procedure to perform similar task.

CREATE FUNCTION CONVERTROW(VAR1 VARCHAR(50))
RETURNS VARCHAR(205)
DETERMINISTIC NO EXTERNAL ACTION
CONTAINS SQL
LANGUAGE SQL
BEGIN ATOMIC
FOR row as SELECT COL FROM SURI;
DO
END FOR;
RETURN RESULT;
END @

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Csaba2000 | last post by:
I have set onmousedown to change the cursor, but this setting is ignored (IE 5.5; NN 6.1 on Win 2K Pro) until the mouse is either moved or the mouse button is released. On Opera 7.01, the setting...
5
by: Vlad Simionescu | last post by:
Hello I'm trying to let my Windows Form application perform a lengthy operation while displaying a progress bar in a modal dialog window; the dialog has a cancel button. The dialog is displayed...
2
by: dave | last post by:
In my form Ive got a SaveData() routine that saves changes to a DB. When I encounter an exception in the save operations, I am having trouble chaning the cursor back to the default cursor, it just...
5
by: Lespaul36 | last post by:
I have a mdi app. I need to change the cursor when I click on certain button on a form that I made into a toolbar. I tried to use cursor.current. But the cursor won't show. if I change the form...
10
by: Just Me | last post by:
Does Me.Cursor.Current=Cursors.WaitCursor set the current property of Me.Cursor to Cursors.WaitCursor And Me.Cursor.Current=Cursors.Default set the Me.Current property to something (default)...
2
by: Alex | last post by:
In the code below, clicking on the button ButtonChangeCursor changes the form's cursor to a WaitCursor. Clicking the button ButtonRestoreCursor changes the form's cursor back to its original...
2
by: Jim Frazer | last post by:
Hi, I'm working on an application in C# that will allow the user to create simple CAD drawings on a CEPC system. I would like to be able to change the cursor shape depending on the drawing mode...
7
by: Academic | last post by:
What are the different effects of the following two statements: C1.Cursor = Cursors.WaitCursor C1.Cursor.Current = Cursors.WaitCursor I believe the first replaces the entire C1.Cursor...
0
debasisdas
by: debasisdas | last post by:
RESTRICTIONS ON CURSOR VARIABLES ================================= Currently, cursor variables are subject to the following restrictions: Cannot declare cursor variables in a package spec. ...
4
by: mike | last post by:
I have the opportunity to rescue a project that uses a mouse to sense the relative position of a machine. The hardware is built...just needs to be programmed. Stop snickering!!! I didn't do it...I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.