473,396 Members | 2,013 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,396 software developers and data experts.

Help with stored procedure

13
Hi there, iam trying to use Firebird with this procedure:

Parameters:

NAAM VARCHAR(120)
VWDID INTEGER
QUOTE DECIMAL (9,3)
QUOTEDATE TIMESTAMP
QUOTETYPE VARCHAR(20)

Expand|Select|Wrap|Line Numbers
  1. BEGIN
  2.   /* Procedure text */
  3.   DECLARE TYPE_ID int
  4.   /* Checken of de quote al bekend is */
  5.   IF(COUNT(QUOTE_VWDID) FROM TBL_QUOTE WHERE QUOTE_VWDID = VWDID) < 1
  6.   BEGIN
  7.        /* Hij is nog niet bekend */
  8.        INSERT INTO TBL_QUOTE (QUOTE_VWDID, QUOTE_NAAM) VALUES (VWDID, NAAM);
  9.   END
  10.   /* Checken of de quotetype al bestaat */
  11.   IF(COUNT(QUOTE_TYPE_NAAM) FROM TBL_QUOTE_TYPE WHERE QUOTE_TYPE_NAAM = NAAM) < 1
  12.   BEGIN
  13.        /* Quote type is nog niet bekend */
  14.        INSERT INTO TBL_QUOTE_TYPE (QUOTE_TYPE_NAAM) VALUES (QUOTETYPE);
  15.   END
  16.   /* Zetten van de type_id */
  17.   SET TYPE_ID = SELECT QUOTE_TYPE_ID FROM TBL_QUOTE_TYPE WHERE QUOTE_TYPE_NAAM = NAAM;
  18.  
  19.   INSERT INTO TBL_QUOTE_LOG (QUOTE_LOG_TIMESTAMP, QUOTE_LOG_QUOTE, QUOTE_VWDID, QUOTE_TYPE_ID)
  20.   VALUES (QUOTEDATE, QUOTE, VWIDID, TYPE_ID);
  21. END
  22.  
I have no idea how to get this stored procedure to work with Firebird

Any help is much appriciated! =)
Sep 13 '09 #1
1 2265
bobido
13
I have managed to work a bit on the procedure, i currently have this error:

Engine Error (code = 335544569):
Dynamic SQL Error.
SQL error code = -206.
Subselect illegal in this context.

SQL Error (code = -206):

Any Idea? thx =)

Expand|Select|Wrap|Line Numbers
  1. SET TERM ^ ;
  2.  
  3. ALTER PROCEDURE PRC_QUOTE_LOG_ADD (
  4.  NAAM      VARCHAR(120),
  5.  VWDID     INTEGER,
  6.  QUOTE     DECIMAL(9,3),
  7.  QUOTEDATE TIMESTAMP,
  8.  QUOTETYPE VARCHAR(20))
  9. AS 
  10. DECLARE VARIABLE TYPE_ID INTEGER;
  11. BEGIN
  12.   /* Procedure text */
  13.   /* Checken of de quote al bekend is */
  14.   IF((SELECT COUNT(QUOTE_VWDID) FROM TBL_QUOTE WHERE QUOTE_VWDID = VWDID) < 1)
  15.   THEN
  16.   BEGIN
  17.        /* Hij is nog niet bekend */
  18.        INSERT INTO TBL_QUOTE (QUOTE_VWDID, QUOTE_NAAM) VALUES (VWDID, NAAM);
  19.   END
  20.   /* Checken of de quotetype al bestaat */
  21.   IF((SELECT COUNT(QUOTE_TYPE_NAAM) FROM TBL_QUOTE_TYPE WHERE QUOTE_TYPE_NAAM = NAAM) < 1)
  22.   THEN
  23.   BEGIN
  24.        /* Quote type is nog niet bekend */
  25.        INSERT INTO TBL_QUOTE_TYPE (QUOTE_TYPE_NAAM) VALUES (QUOTETYPE);
  26.   END
  27.  
  28.   /* Zetten van de type_id */
  29.   TYPEID = (SELECT QUOTE_TYPE_ID FROM TBL_QUOTE_TYPE WHERE QUOTE_TYPE_NAAM = NAAM);
  30.  
  31.   INSERT INTO TBL_QUOTE_LOG (QUOTE_LOG_TIMESTAMP, QUOTE_LOG_QUOTE, QUOTE_VWDID, QUOTE_TYPE_ID)
  32.   VALUES (QUOTEDATE, QUOTE, VWIDID, TYPE_ID);
  33. END;^
  34.  
  35. SET TERM ; ^
  36.  
Sep 14 '09 #2

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

Similar topics

2
by: berthelot samuel | last post by:
Hi everyone, I am currently trying to write a report based on a View of SQL Server. Basically, I have 3 tables : Hardware, SoftwareInstalled and Software with SoftwareInstalled that keeps track of...
7
by: Bill Kellaway | last post by:
Hi there - this should be fairly simple for someone. Basically I can't figure out how to pass the parameters from ASP to a Stored Procedure on SQL. Here's my code: I just need to help in...
1
by: Ken | last post by:
Hello, I have a webform that gets a record from SQL Server by using a stored procedure. The stored procedure uses 3 parameters in which after the record is found, stored procedure #2 runs to...
1
by: Kumar | last post by:
Hi I am trying to recreate a database under the following environments : From: Solaris with DB2UDB version 7.2 with FP 9 To: Linux with DB2UDB version 7.2 with FP 9 It will be of really a...
2
by: Dino L. | last post by:
How can I run stored procedure (MSSQL) ?
7
by: Siv | last post by:
Hi, I have a stored procedure that I want to execute and then wait in a loop showing a timer whilst it completes and then carry on once I get notification that it has completed. The main reason...
1
by: peaceburn | last post by:
Hi, I'm gonna pull my hair in the coming days with these DB2 stored procedures. So the issue, let's assume a simple stored procedure like this : CREATE PROCEDURE MYSCHEMA.PROCEDURE1 ( )...
3
by: Darth Ferret | last post by:
This thing is about to drive me crazy. I have about 50 queries in the AS400 that I need to put on a menu. Once I conquer this I have a bunch more rpg reports that I need to pass a date to. In the...
17
by: Riaaaa | last post by:
Pls check my code for the stored procedure which i created for the companydetails including companyid P.K. Not Null int(4), companyname Not Null varchar (20), address varchar(30) where...
0
by: SOI_0152 | last post by:
Hi all! Happy New Year 2008. Il hope it will bring you love and happyness I'm new on this forum. I wrote a stored procedure on mainframe using DB2 7.1.1 and IBM language c. Everything works...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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,...

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.