in reply to Re^2: Help on selecting and deleting many records in a DB.
in thread Help on selecting and deleting many records in a DB.
Creating a function for your needs can be as simple as:
1. Write this code in a file called myfun.test:
CREATE OR REPLACE PROCEDURAL LANGUAGE plperlu; ALTER PROCEDURAL LANGUAGE plperlu OWNER TO postgres; CREATE OR REPLACE FUNCTION mytest(text) RETURNS text LANGUAGE plperlu AS $_X$ my $data = $_[0]; my $string = $data." -->from mytest\n"; return $string; $_X$;
(Of course you can have as many arguments and return types you want in your function's definition.)
2. Insert/replace this function in your db by issuing the command line:
# \i /path/to/myfun.test3. Run the test (given a table called data and a text field called f1):
# select mytest(f1) from data limit 10And that's it... When your function will be ready you can dump/restore it permanently into your db if you want.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Help on selecting and deleting many records in a DB.
by Anonymous Monk on Apr 06, 2014 at 07:14 UTC | |
by Anonymous Monk on Apr 06, 2014 at 08:39 UTC | |
by Anonymous Monk on Apr 06, 2014 at 09:28 UTC | |
by Anonymous Monk on Apr 06, 2014 at 07:34 UTC |