473,791 Members | 2,827 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Host Variable, SELECT INTO


Does the term 'host variable' cover a variable locally declared in a
SQL-PL stored procedure? [ I think SQL PL doesn't qualify as a 'host
language' in the sense of embedded sql. ]

I am asking this question in the context of the SELECT INTO statement.

Nov 12 '05 #1
3 6829
The description of FETCH INTO also uses the term 'host variable', and
in the samples that come with DB2 I found

-- SQL-PL declarations for local variables, 'host variables':
DECLARE v_dept CHAR(3);
DECLARE v_deptname VARCHAR(29);
DECLARE v_admdept CHAR(3);

-- declare c1:
-- ...

-- use c1:
OPEN c1;
FETCH c1 INTO v_dept, v_deptname, v_admdept;

Therefore, SQL-PL-variables should qualify as 'host variables'. Also in
SELECT INTO. Right?

Nov 12 '05 #2
cl*********@abr axas.ch wrote:
Does the term 'host variable' cover a variable locally declared in a
SQL-PL stored procedure? [ I think SQL PL doesn't qualify as a 'host
language' in the sense of embedded sql. ]

I am asking this question in the context of the SELECT INTO statement.

Yes.. There is a general statement in "Identifier s" where SQL Variables
are defined:

"SQL-variable-name
The name of a local variable in an SQL procedure statement.
:=> SQL variable names can be used in other SQL statements where
:=> a host variable name is allowed.
The name can be qualified by the label of the compound statement that
declared the SQL variable."

Important not eon SELECT INTO and VALUES INTO:
These statements are allowed in SQL Procedures (SQL PL) but not in
Triggers and SQL Functions (inline SQL PL). For the later use the
(multicolumn) SET statement.

Cheers
Serge
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #3
Thank you, problem solved.

Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6000
by: Chris | last post by:
I have tableA, defined as: field1 varchar2(10), field2 varchar2(10), field3 varchar2(10) I have host variables defined as: v1 pic x(10) varying v2 pic x(10) varying
4
13070
by: Tim.D | last post by:
People, I've ventured into the wonderful world of Stored Procedures. My first experience has been relatively successful however I am stuck on using host variables to specifiy actualy table or column names in a FROM clause. After many hours or reading all manner of manuals I've discovered it appears this is not possible and that in order to so I need to further venture into dynamic SQL. My present procedure is based on all static SQL...
2
2198
by: Jeff | last post by:
I have an ASP.NET web page accessing a SQL database. I've used VS to build the app and stored it in the eNPTest02 directory of my localhost on my development machine. The database is on the web. I've found a way that works on the web, and I'm trying to get it to also work in debug mode in the IDE. The "on the web" page and my SQL database are hosted by a third party (on separate servers). Since debug mode opens IE and loads my page...
4
2527
by: 4.spam | last post by:
Hello. UDB DB2 v8.2.1 for LUW. Why this function can't be compiled? --- CREATE FUNCTION MYLIKE(NM VARCHAR(128)) LANGUAGE SQL RETURNS INTEGER BEGIN ATOMIC RETURN
2
5621
by: Frank Swarbrick | last post by:
I'm just learning about embedded SQL, so be gentle... My basic question is, if I use a fixed length host variable for a column defined as VARCHAR, will trailing spaces be removed (or not) upon INSERT or UPDATE of this column? I tried it, and it appears they are *not* stripped. However, the Programming Client Applications manual leads me to believe that the spaces should be stripped. A quote from that manual: -------------------------...
5
8187
by: Patrick | last post by:
Hi all, In my SQL procedures in DB2 8.2, I current declare several cursors that return select statements with 10 columns in it. As a result, assigning host variables becomes a coding mess, as I would have to declare anywhere from 50-100 host variables just so I can process them. Is it possible to fetch the row from a cursor into a single
1
2569
by: young | last post by:
Hello all, I tried to do a sqc program with a "SELECT column INTO :host_variable FROM table" statement and got an error SQL4942N="The statement selects an incompatible data type into host variable" My column is Decimal(6,2) data type definition, and my host variable is defined as float I work on AIX 5.2 with DB2 8.2 Any idea?
0
2765
by: rsilvers | last post by:
what type of overhead will this select statement cause to db2 on z/os mainframe ? This is an imbedded SQL in COBOL Declare cursor C1 for select number, key1, key2 from table where type = 'TYPE' and number = :ws-number and date(eff_date) <= :ws-start-date and date(exp_date) >= :ws-end-date
0
1988
by: msmithuk | last post by:
Hi, Can anyone help on why I am getting this SQL Pre processor error. This is a function that receives a pointer to pre-allocated storage. However I think DB2 is complaining because my host variable is based. The DB2 manual says "If you use the BASED storage attribute, you must follow it with a PL/I element-locator-expression."
0
10426
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
10207
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...
1
10154
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9029
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
7537
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
5430
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
4109
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
3713
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2913
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.