473,394 Members | 1,852 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,394 software developers and data experts.

Executing function dynamically

2
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 2931
prdola
2
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
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...
7
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...
4
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,...
2
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...
5
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...
13
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 =...
7
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...
6
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...
0
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...
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
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...
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
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...
0
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...
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...

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.