473,756 Members | 2,378 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with stored procedure

13 New Member
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 2287
bobido
13 New Member
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
4705
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 all the software installed on each piece of hardware by referencing the primary keys of each table. So now, I have a request that retrieve information from those 3 tables giving a list of all the hardware with their details + the software...
7
9011
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 learning how to pass these varibables from ASP to the SP.
1
1315
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 update one of the columns called Status from "incomplete" to "Pending" Status is one of the parameters for stored procedure #1. This all works fine, My problem is after the person is finished with the record they then push the next button to get...
1
2000
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 great help if any one help me in step-by-step guidelines to migrate SPs written in Java & C languages. I have successfully recreated SQL procedures.
2
5458
by: Dino L. | last post by:
How can I run stored procedure (MSSQL) ?
7
9714
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 for this being to stop the user thinking the application has frozen when in fact it is just waiting for a long SP to complete. Another reason for doing it like this is that I also have had a problem in the past where the SP takes longer than the...
1
7530
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 ( ) DYNAMIC RESULT SETS 1 ------------------------------------------------------------------------
3
4096
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 AS400 I have a stored procedure (SPRUNQRY) that runs the RUNQRY command with the name of the query as a parameter. In the AS400 I would type "RUNQRY SUNTR401A" on a command line to run this query. My connection is opening, and I can run some...
17
4013
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 companyid is the primary key and it should be autogenerate.
0
3192
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 fine. Now we decided to move from mainframe IMS-DB2 to Windows 2003 server-DB2 UDB for LUW 9.5.
0
9255
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10014
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9844
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9689
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8688
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7226
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5119
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3780
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3326
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.