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 January 4th, 2007, 08:14 PM
seanzcan seanzcan is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2007
Posts: 3 seanzcan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 43 m 18 sec
Reputation Power: 0
Question Failed to create stored procedure in Firebird

I am trying firebird on my new project but stuck on how to create stored procedures. There is no luck either from .NET provider or from the admin tool "IB_SQL".

here is what I did:

the Table is simple one like this:
CITY (ID integer, NANE varchar(100))

and the Stored Procedure is as following:

CREATE PROCEDURE sp_City (CITY VARCHAR(100))
RETURNS (CITYID INTEGER)
AS
BEGIN
SELECT ID FROM CITY WHERE NAME=:CITY INTO :CITYID;
--I tried as follow too, does not work either:
--SELECT ID INTO :CITYID FROM CITY WHERE NAME=:CITY;
/*
IF (CITYID IS NULL) THEN
BEGIN
CITYID = GEN_ID(GID_CITY,1);
INSERT INTO CITY (ID, NAME) VALUES (:CITYID,:CITY);
END
*/
END




hope someone can help me out.
many thanks.

Reply With Quote
  #2  
Old January 5th, 2007, 01:59 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
What's the error message you're getting?

--
Martijn Tonies
Upscene Productions
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
  #3  
Old January 5th, 2007, 09:25 PM
seanzcan seanzcan is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2007
Posts: 3 seanzcan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 43 m 18 sec
Reputation Power: 0
"Unsupported column type: 0" or "'mn 16' is not a valid integer value"

Hi Martijn,

Thanks for your response.

When I tried like this I got Unsupported column type: 0 error.

CREATE PROCEDURE sp_City (CITY VARCHAR(100))
RETURNS (CITYID INTEGER)
AS
BEGIN
SELECT ID FROM CITY WHERE NAME=:CITY INTO :CITYID;
/*
IF (CITYID IS NULL) THEN
BEGIN
CITYID = GEN_ID(GID_CITY,1);
INSERT INTO CITY (ID, NAME) VALUES (:CITYID,:CITY);
END
*/
END


if I change to the following I got 'mn 16' is not a valid integer value error.

CREATE PROCEDURE sp_City (CITY VARCHAR(100))
RETURNS (CITYID INTEGER)
AS
BEGIN
SELECT ID INTO :CITYID FROM CITY WHERE NAME=:CITY;
/*
IF (CITYID IS NULL) THEN
BEGIN
CITYID = GEN_ID(GID_CITY,1);
INSERT INTO CITY (ID, NAME) VALUES (:CITYID,:CITY);
END
*/
END


and the table I was using is CITY (ID integer, NAME varchar(100))

I am new to Firebird and it must be something really silly I did, but I just could not find it, the procedure is so simple and in fact
I just copied from the document.

Appreciated for your help.






Quote:
Originally Posted by upscene
What's the error message you're getting?

--
Martijn Tonies
Upscene Productions
(URL address blocked: See forum rules)

Reply With Quote
  #4  
Old January 6th, 2007, 06:31 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
It seems you're trying to create the procedure from the DSQL tab in IB_SQL or something?

Try the Script tab, or make sure to NOT check for parameters on the DSQL tab.

Reply With Quote
  #5  
Old January 6th, 2007, 06:58 PM
seanzcan seanzcan is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2007
Posts: 3 seanzcan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 43 m 18 sec
Reputation Power: 0
:)Thanks!

Thanks for your help.

You are right, I was using the ID_SQL's DSQL tab to create the stored procedure, and when I ticked off the parameter check box, it works.

BTW, any better admin tools you could recommend?

Reply With Quote
  #6  
Old January 7th, 2007, 06:12 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
The tool we develop is much better

Database Workbench: www.upscene.com

--
Martijn

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > Failed to create stored procedure in Firebird


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 6 hosted by Hostway
Stay green...Green IT