473,836 Members | 1,505 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I get query result(select e.g.) from a dynamic command(EXECUTE )?

Hi,

I want to do a select in dynamic command, something like:

TRIGGER FUNCTION
DECLARE
table_name_suff ix text;
temp_result RECORD;
temp_result2 RECORD;

....

BEGIN
--initialization of table_name_suff ix(from TG_RELNAME e.g.)
select into temp_result from
''fixed_table_n ame_prefix''||t able_name_suffi x where another_table_n ame =
abc;

--Then I want to use part of the result as part of the table name for my
next query
select into temp_result2 from
''fixed_table_n ame_prefix''||t emp_result.anot hertablename;

END

I know that SELECT INTO doesn't support dynamic command, EXECUTE does. But
if I EXECUTE a select query, how do I get
the select result from it?

Many thanks,

Wei Wang
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 22 '05 #1
2 4502
Sorry. I just found it in the documentation. FOR-IN-EXECUTE or
OPEN-FOR-EXECUTE.
----- Original Message -----
From: "Wei Wang" <ww***@cam.ac.u k>
To: "pgsql" <pg***********@ postgresql.org>
Sent: Thursday, February 19, 2004 11:50 AM
Subject: [GENERAL] How do I get query result(select e.g.) from a dynamic
command(EXECUTE )?

Hi,

I want to do a select in dynamic command, something like:

TRIGGER FUNCTION
DECLARE
table_name_suff ix text;
temp_result RECORD;
temp_result2 RECORD;

...

BEGIN
--initialization of table_name_suff ix(from TG_RELNAME e.g.)
select into temp_result from
''fixed_table_n ame_prefix''||t able_name_suffi x where another_table_n ame =
abc;

--Then I want to use part of the result as part of the table name for my next query
select into temp_result2 from
''fixed_table_n ame_prefix''||t emp_result.anot hertablename;

END

I know that SELECT INTO doesn't support dynamic command, EXECUTE does. But
if I EXECUTE a select query, how do I get
the select result from it?

Many thanks,

Wei Wang
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postg resql.org

Nov 22 '05 #2
On Thursday 19 February 2004 11:50, Wei Wang wrote:
Hi,

I want to do a select in dynamic command, something like:
[snip] I know that SELECT INTO doesn't support dynamic command, EXECUTE does. But
if I EXECUTE a select query, how do I get
the select result from it?

FOR record | row IN EXECUTE text_expression LOOP
statements
END LOOP;

It's in the manuals, but that's about all they say on the subject
--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 22 '05 #3

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

Similar topics

6
2079
by: B Love | last post by:
I am wondering if I can have a dynamically generated report based upon the results of a query (in Access2000). Any ideas? Related to that (if that cannot be done) can the output of a query generate a set of records in form view. ( The second request sounds even more impossible to the first!) . Thanks for any insight you can share with me! ~Bruce
10
1676
by: pw | last post by:
Hi, Is that possible if the crosstab query is dynamic? Doesn't seem so as I have to specify the control source for the text boxes and the number of columns may change, along with their field names. Just thought I'd take a shot in the dark. -pw
0
3520
by: starace | last post by:
I have designed a form that has 5 different list boxes where the selections within each are used as criteria in building a dynamic query. Some boxes are set for multiple selections but these list boxes do not necessarily need to have a selection made to be used in the dynamic query. In essence the form can have selections made in all or none of its list boxes to form the dynamic query I am looking to get some feedback in reference to...
3
13790
by: bjaj | last post by:
Hi I need some help to my VBA code. I want to open a query in Edit mode Change a parameter and then save the qyery and close it. A)I now how to do open the query in editmode docmd.openquery ect ect. B)I dont now how to change the parameter
10
2787
by: s.subbarayan | last post by:
Dear all, I happen to come across this exciting inspiring article regarding memory leaks in this website: http://www.embedded.com/story/OEG20020222S0026 In this article the author mentions: "At a certain point in the code you may be unsure if a particular block is no longer needed. If you free() this piece of memory, but continue to access it (probably via a second pointer to the same
2
1956
by: planetthoughtful | last post by:
Hi All, I'd like to place a subreport onto a report that draws its records from a UNION query. When I design the query and view the records all looks fine. However, when I put the query as the subreport's data source and open it, Access complains that Jet can't find the table, and then when I open up the query itself to look at the SQL, it appears all mangled.
0
1434
by: qarmoe | last post by:
Please open the Screen Print (attached), else it's not gonna makes sense... http://download.yousendit.com/A61005CA7194C418 SELECT DISTINCT MSysObjects.Name FROM MSysObjects WHERE (((MSysObjects.Name) Not Like "msys*" And (MSysObjects.Name) Not Like "all*") AND ((MSysObjects.Type)=1));
1
1216
by: onlymukti4u | last post by:
Hi, I have a form page having two listboxes, One is having three teachers names and other having few students names...What exactly I want is, by clicking the respective Teacher names only their students name should appear in the second list box,So can anyone help me out in providing the codes for it? Regards, Mukti
5
1908
by: ravindarjobs | last post by:
hello friends, i am using ms access 2003. i have a form. and i want to show the results of a query output in the form. the query is dynamic. it changes often. for this purpose data grid suits well. but we dont have data grid in ms access(by default).
0
2015
by: Martin Ruprecht | last post by:
Hi, I do have a big problem: We are creating a reporting tool for logistic solutions using Crystal Reports. I actually am programming a history report. There are millions of lines in the resultset. I have added two date-parameter-prompts (date-from and date-until) to the query itself to prevent Crystal Reports from fetching millions of rows over TCP/IP. The problem: As soon as I'm adding a parameter/prompt (which is defined as...
0
9818
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10844
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
10546
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
10590
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
10254
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...
1
7791
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
5649
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...
0
5825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4016
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.