473,796 Members | 2,607 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Executing function dynamically

2 New Member
Hi,
I have a table with function names and some other flags where to run them. Sth like this table called PROCESS

Expand|Select|Wrap|Line Numbers
  1. name    run_daily   run_monthly
  2. func1       Y                   N
  3. func2       Y                   Y
  4. func3       N                   Y
  5. ...
then I have function that should execute selected functions sth like

Expand|Select|Wrap|Line Numbers
  1. create or replace function execute_process() returns void as
  2. $$
  3. declare
  4.   c_process refcursor; 
  5.   r_process dwh_loader.process%ROWTYPE;
  6.   v_stmt varchar(200);
  7. begin
  8.   OPEN c_process FOR SELECT * 
  9.                        FROM process 
  10.                       WHERE run_daily = 'Y';
  11.   LOOP
  12.     fetch c_process into r_process;
  13.     -- 
  14.     IF  NOT FOUND THEN
  15.         EXIT;  -- exit loop
  16.     END IF;    
  17.     v_stmt := 'perform '|| r_process.name ||';';
  18.     --
  19.     execute v_stmt;
  20.   END LOOP;
  21.   --
  22.   return;
  23. end;
  24. $$language plpgsql;
This is pretty much how I would handle this situation in Oracle, but Postgre does not allow
execute 'perform....'

Any suggestion how to resolve this issue?

Karel
Oct 17 '08 #1
1 2949
prdola
2 New Member
Suggestion is to use

execute 'command string' into variable;

like here
http://www.postgresql. org/docs/8.3/static/plpgsql-statements.html #PLPGSQL-STATEMENTS-EXECUTING-DYN
Oct 23 '08 #2

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

Similar topics

14
10464
by: Jay O'Connor | last post by:
Is there a good way to import python files without executing their content? I'm trying some relfection based stuff and I want to be able to import a module dynamically to check it's contents (class ad functions defined) but without having any of the content executed. For example: ---------------------- def test(var): print var
7
6219
by: Rick Caborn | last post by:
Does anyone know of a way to execute sql code from a dynamically built text field? Before beginning, let me state that I know this db architecture is built solely for frustration and I hope to make it better soon. Unfortunately, there is never a non-crucial time in which we can do an upgrade, so we are stuck for now. Point 1: There are multiple tables: students, courses, cross-reference
4
1375
by: zmcelrath87 | last post by:
I am having a problem involving the scope of timeouts and intervals. Since timeouts and intervals execute in the global scope, dynamically generated local interval/timeout declarations do not work, because the dynamically generated code they have to execute involves variables that have been thrown out by the time of execution. In the first of the two following code examples, my interval declaration includes code that relies on variables...
2
1044
by: Byron Hopp | last post by:
Is this possible in Vb.Net? Dim strFuncName as String Dim strFuncParm as String strFuncName = "MyFunc(strFuncParm)" strFuncParm = "Hello World" Can I call a function which when I pass strFuncName to it, it will execute the function MyFunc()?
5
2486
by: reycri | last post by:
Hi, I need to be able to do this: var func = new Function("var me = <selfRef>; alert(me.params);"); func.params = "This is a test parameter"; window.setTimeout(func, 500); Basically, I need to add properties to a function object and access them within the function when it is executing. Therefore, I need to be
13
2539
by: mowsen | last post by:
Hello Group, i'm using a little "ajax" loader script to dynamically load files into different "div" tags on my main site. the code for this part looks like: function loader() { var args = loader.arguments; switch (args) { case
7
10086
by: chage | last post by:
Hi, I have been searching around to try adding reference assembly to another assembly during runtime, programatically. Is this possible in .Net? The reason for this is because i am having trouble using a library that creates an instance of a Type that i specified, and it failed the locate the Type during runtime, if i do not reference it during compile time.
6
2800
by: cantrell78 | last post by:
I can't for the life of me figure out how to execute javascript inside of div that was set using innerHTML or in my case using cloneNode and replaceChild (not my idea to do this, I'm just fixing it). I have tried it with and without the defer attribute. It will work fine in firefox, but not IE. <script type="text/javascript"> function setInnerHTMLAndExecScript (element, html) { var newElement = element.cloneNode(false);...
0
1566
Frinavale
by: Frinavale | last post by:
I have a peculiar problem... Background: I have a function that I don't want the user to execute more than once while they are waiting for it to process; therefore, I disable all of the controls on the page via some JavaScript before the request is sent. This function takes some time to execute because it has to communicate with hardware that is rather slow. This slowness combined with a little bit of lag sometimes results in a ...
0
9531
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
10459
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
10237
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
10018
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
9055
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...
0
5446
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
5578
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4120
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
3735
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.