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 March 8th, 2006, 10:12 AM
volhoop volhoop is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2006
Posts: 1 volhoop User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 49 m 43 sec
Reputation Power: 0
Stored Procedure

I'm an AS400/VB.NET programmer that has worked with DB400 and MS-Access databases. I'm reviewing Firebird 1.5 as a true DBMS replacement to replace MS-Access. I've been very impressed with Firebird so far, and I'm glad to see that it is still evolving.
The area I'm a little uncomfortable with is documentation. I've been reading a lot of info from the web about Stored Procedures. They seem like a very good tool, but I can not find much documentation on coding/examples. Could someone offer a source for working with Stored Procedures?

Below is a simple procedure I tried to write in IBSQL.


CREATE PROCEDURE EMPINFO
RETURNS(EmpId VARCHAR(9), uName VARCHAR(50))
AS

DECLARE VARIABLE LastName VARCHAR(15);
DECLARE VARIABLE FirstName VARCHAR(15);

BEGIN

FOR
SELECT emp_id, last_name, first_name
FROM employee_tbl
INTO :EmpID, :LastName, :FirstName
DO
BEGIN
uName = UPPER(:LastName || ", " || :FirstName);
END

SUSPEND;

END




ERROR RETURNED BY IBSQL

ISC ERROR CODE:335544569

ISC ERROR MESSAGE:
Dynamic SQL Error
SQL error code = -206
Column unknown
,
At line 16, column 23. "LastName"

Reply With Quote
  #2  
Old March 8th, 2006, 05:26 PM
Dobrica Dobrica is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 2 Dobrica User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 50 m 5 sec
Reputation Power: 0
Quote:
Originally Posted by volhoop
I'm an AS400/VB.NET programmer that has worked with DB400 and MS-Access databases. I'm reviewing Firebird 1.5 as a true DBMS replacement to replace MS-Access. I've been very impressed with Firebird so far, and I'm glad to see that it is still evolving.
The area I'm a little uncomfortable with is documentation. I've been reading a lot of info from the web about Stored Procedures. They seem like a very good tool, but I can not find much documentation on coding/examples. Could someone offer a source for working with Stored Procedures?

Below is a simple procedure I tried to write in IBSQL.


CREATE PROCEDURE EMPINFO
RETURNS(EmpId VARCHAR(9), uName VARCHAR(50))
AS

DECLARE VARIABLE LastName VARCHAR(15);
DECLARE VARIABLE FirstName VARCHAR(15);

BEGIN

FOR
SELECT emp_id, last_name, first_name
FROM employee_tbl
INTO :EmpID, :LastName, :FirstName
DO
BEGIN
uName = UPPER(:LastName || ", " || :FirstName);
END

SUSPEND;

END




ERROR RETURNED BY IBSQL

ISC ERROR CODE:335544569

ISC ERROR MESSAGE:
Dynamic SQL Error
SQL error code = -206
Column unknown
,
At line 16, column 23. "LastName"


Try this:
SELECT emp_id, UPPER(last_name || ", " || first_name) as full_name FROM employee_tbl INTO :EmpID, :FullName;

"as full_name" in select statement is not required. "UPPER(last_name || ", " || first_name)" is good enough

Reply With Quote
  #3  
Old March 13th, 2006, 05:50 PM
dcostelloe dcostelloe is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2006
Location: Burlington, Ontario Canada
Posts: 10 dcostelloe User rank is Private First Class (20 - 50 Reputation Level)dcostelloe User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 h 4 m 39 sec
Reputation Power: 0
Send a message via MSN to dcostelloe
Talking Parms or variable

I thought that only inputs use the : not variables?

Hope this helps

EMS has a nice freeware tool for Admin of FireBird.

EMS FireBird SQL Manager


Last edited by dcostelloe : March 13th, 2006 at 05:53 PM. Reason: Updated Link

Reply With Quote
  #4  
Old March 14th, 2006, 05:41 AM
NaturePhoenix NaturePhoenix is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2006
Posts: 1 NaturePhoenix User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 45 sec
Warnings Level: 10
Number of bans: 1
Reputation Power: 0
URL

Free iPods and other items!!!!--->Click to Join Now and receive FREE ITEMS including including $250 USD!!! I'll pay $25 USD for anyone who signs up under me and completes an offer. As soon as offer greens I pay INSTANTLY!!!

RewardBull-Free Cash/iPods - you can make up to $350 very easily!!! All you have to do is SignUp And Complete offers yourself, or get referrals to complete 1 bull each.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > Stored Procedure


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 4 hosted by Hostway