Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 3rd, 2004, 05:50 AM
Hesder Hesder is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 2 Hesder User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Declare cursor problem

Hey,

Recently I’m using Firebird, great database only little in documentation. At the moment I’m using the IB 6.0 documentation from the firebird site, only I think these are outdated? Some statements just don’t seem to work in Firebird 1.5, like some of the stored procedures I’ve found in these books. For example: “Set Term ^;” and more important I don’t seem to get cursor statements working in Firebird (not even when using the same example)

Could someone tell me what I’m doing wrong?

Hesder


For example a cursor statement I’ve tried to convert from oracle to Firebird 1.5 :

CREATE PROCEDURE get_records_10monsteroverzicht(
session_id VARCHAR(25),
group_name VARCHAR(25),
date_from VARCHAR(25)
) AS


BEGIN

declare c_template CURSOR for
select tmplt_name
from ip_smpl_grp_DETAIL
where smpl_grp_name = group_name
ORDER BY tmplt_name;

...how to use cursor in firebird?...

END

Reply With Quote
  #2  
Old August 8th, 2004, 09:07 AM
upscene upscene is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 223 upscene User rank is Corporal (100 - 500 Reputation Level)upscene User rank is Corporal (100 - 500 Reputation Level)upscene User rank is Corporal (100 - 500 Reputation Level)upscene User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 7 h 14 m 50 sec
Reputation Power: 8
Quote:
Originally Posted by Hesder
Some statements just don’t seem to work in Firebird 1.5, like some of the stored procedures I’ve found in these books. For example: “Set Term ^;” and

SET TERM is only used by client tools. What are you using to connect and run your scripts?
Quote:
Originally Posted by Hesder
more important I don’t seem to get cursor statements working in Firebird (not even when using the same example)

Could someone tell me what I’m doing wrong?
For example a cursor statement I’ve tried to convert from oracle to Firebird 1.5 :

CREATE PROCEDURE get_records_10monsteroverzicht(
session_id VARCHAR(25),
group_name VARCHAR(25),
date_from VARCHAR(25)
) AS


BEGIN

declare c_template CURSOR for
select tmplt_name
from ip_smpl_grp_DETAIL
where smpl_grp_name = group_name
ORDER BY tmplt_name;

...how to use cursor in firebird?...

END

Firebird doesn't support a CURSOR, it does support cycling through resultsets via a FOR SELECT construct:

FOR SELECT tmplt_name
from ip_smpl_grp_DETAIL
where smpl_grp_name = group_name
ORDER BY tmplt_name
INTO :variable_name
DO ... loop ...



With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL Server.
Upscene Productions
http://www.upscene.com
__________________
Martijn Tonies
Database Workbench: developer IDE for Firebird, MySQL, InterBase, MSSQL Server and Oracle
Upscene Productions
http://www.upscene.com

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > Declare cursor problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway