Thanks Peasant. Tried the option. Take for example the following file which has these contents.
What is interesting is, the program read the first statement, changed WITH DATA to WITH NO DATA and skipped adding INSERT statement. Read the next one, added the INSERT but changed the format.
Hello all
i have big test file that has allot of structure text something like this :
<foo1 *.html>
<blah action>
somthing 1
somthing 2
</blah>
</foo1 >
now i will like to insert 2 more lines of text below the <blah action>
so it will be like :
<foo1... (1 Reply)
In emacs I perform a non-regex search and replace where the pattern is
'
+ '
and the replacement text length is zero. Note that the first and last characters in the search pattern are apostrophes.
How can I write a bash script to automate this search and replace using... (1 Reply)
Hi,
I have a directory with possibly around 800,000 files in it.
What is the fastest way to list file(s) in this directory with a wildcard.
for example would
ls -1 *.abcdefg.Z
or
find . -name "*.abcdefg.Z"
be the fastest way to find all of the files that end with .abcdefg.Z... (6 Replies)
Hi,
I generated an Oracle schema DDL script file using the show=y option of the Oracle import utility but the file that it generates needs a little more formating before we can run this as simple DDL comands to generate the schema at Target using the script file.Here is the simplified output of... (1 Reply)
Hi,
I need to convert the following file into DB insert statements.
$ cat input.txt
START
name=john
id=123
date=12/1/09
END
START
name=sam
id=4234
status=resigned
date=12/1/08
END (2 Replies)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
The assignment is posted below:
Maintain automobile records in a database
Write a shell script to create,... (1 Reply)
Enclosed is comma separated text file. I need to write a korn shell program that will parse the text file and insert the values into Oracle database.
I need to write the korn shell program on Red Hat Enterprise Linux server.
Oracle database is 10g. (15 Replies)
HI All
Im trying to come up with an approach to finding a string, using a portion of that string to insert it on lines starting with the value "GOTO" appending to end of line after removing PT's ( See example below! )
EXAMPLE:
1. I would like to search for the line that starts with "TLAXIS/"... (7 Replies)
I have a log file that's created daily by this command:
sar -u 300 288 >> /var/log/usage/$(date "+%Y-%m-%d")_$(hostname)_cpu.log
It that contains data like this:
Linux 3.16.0-4-amd64 (myhostname) 08/15/2015 _x86_64_ (1 CPU)
11:34:17 PM CPU %user %nice ... (12 Replies)
Hi Experts,
I have a situation where I need to write a shell script to continuously monitor a log directory with multiple log files and perform following:
1. Read the latest log file continuously and grep "Success" OR "Failure"
2. As it capture either Success or Failure, it has to perform a... (1 Reply)
Discussion started by: rish_max
1 Replies
LEARN ABOUT REDHAT
create_trigger
CREATE TRIGGER(7) SQL Commands CREATE TRIGGER(7)NAME
CREATE TRIGGER - define a new trigger
SYNOPSIS
CREATE TRIGGER name { BEFORE | AFTER } { event [OR ...] }
ON table FOR EACH { ROW | STATEMENT }
EXECUTE PROCEDURE func ( arguments )
INPUTS
name The name to give the new trigger. This must be distinct from the name of any other trigger for the same table.
event One of INSERT, DELETE or UPDATE.
table The name (optionally schema-qualified) of the table the trigger is for.
func A user-supplied function that is declared as taking no arguments and returning type trigger.
arguments
An optional comma-separated list of arguments to be provided to the function when the trigger is executed, along with the standard
trigger data such as old and new tuple contents. The arguments are literal string constants. Simple names and numeric constants may
be written here too, but they will all be converted to strings.
OUTPUTS
CREATE TRIGGER
This message is returned if the trigger is successfully created.
DESCRIPTION
CREATE TRIGGER will enter a new trigger into the current data base. The trigger will be associated with the relation table and will execute
the specified function func.
The trigger can be specified to fire either before BEFORE the operation is attempted on a tuple (before constraints are checked and the
INSERT, UPDATE or DELETE is attempted) or AFTER the operation has been attempted (e.g., after constraints are checked and the INSERT,
UPDATE or DELETE has completed). If the trigger fires before the event, the trigger may skip the operation for the current tuple, or change
the tuple being inserted (for INSERT and UPDATE operations only). If the trigger fires after the event, all changes, including the last
insertion, update, or deletion, are ``visible'' to the trigger.
If multiple triggers of the same kind are defined for the same event, they will be fired in alphabetical order by name.
SELECT does not modify any rows so you can not create SELECT triggers. Rules and views are more appropriate in such cases.
Refer to the chapters on SPI and Triggers in the PostgreSQL Programmer's Guide for more information.
NOTES
To create a trigger on a table, the user must have the TRIGGER privilege on the table.
In PostgreSQL versions before 7.3, it was necessary to declare trigger functions as returning the placeholder type opaque, rather than
trigger. To support loading of old dump files, CREATE TRIGGER will accept a function declared as returning opaque, but it will issue a
NOTICE and change the function's declared return type to trigger.
As of the current release, STATEMENT triggers are not implemented.
Refer to the DROP TRIGGER [drop_trigger(7)] command for information on how to remove triggers.
EXAMPLES
Check if the specified distributor code exists in the distributors table before appending or updating a row in the table films:
CREATE TRIGGER if_dist_exists
BEFORE INSERT OR UPDATE ON films FOR EACH ROW
EXECUTE PROCEDURE check_primary_key ('did', 'distributors', 'did');
Before cancelling a distributor or updating its code, remove every reference to the table films:
CREATE TRIGGER if_film_exists
BEFORE DELETE OR UPDATE ON distributors FOR EACH ROW
EXECUTE PROCEDURE check_foreign_key (1, 'CASCADE', 'did', 'films', 'did');
The second example can also be done by using a foreign key, constraint as in:
CREATE TABLE distributors (
did DECIMAL(3),
name VARCHAR(40),
CONSTRAINT if_film_exists
FOREIGN KEY(did) REFERENCES films
ON UPDATE CASCADE ON DELETE CASCADE
);
COMPATIBILITY
SQL92 There is no CREATE TRIGGER statement in SQL92.
SQL99 The CREATE TRIGGER statement in PostgreSQL implements a subset of the SQL99 standard. The following functionality is missing:
o SQL99 allows triggers to fire on updates to specific columns (e.g., AFTER UPDATE OF col1, col2).
o SQL99 allows you to define aliases for the ``old'' and ``new'' rows or tables for use in the definition of the triggered action
(e.g., CREATE TRIGGER ... ON tablename REFERENCING OLD ROW AS somename NEW ROW AS othername ...). Since PostgreSQL allows trigger
procedures to be written in any number of user-defined languages, access to the data is handled in a language-specific way.
o PostgreSQL only has row-level triggers, no statement-level triggers.
o PostgreSQL only allows the execution of a stored procedure for the triggered action. SQL99 allows the execution of a number of
other SQL commands, such as CREATE TABLE as triggered action. This limitation is not hard to work around by creating a stored
procedure that executes these commands.
SQL99 specifies that multiple triggers should be fired in time-of-creation order. PostgreSQL uses name order, which was judged more conve-
nient to work with.
SEE ALSO
CREATE FUNCTION [create_function(7)], ALTER TRIGGER [alter_trigger(l)], DROP TRIGGER [drop_trigger(l)], PostgreSQL Programmer's Guide
SQL - Language Statements 2002-11-22 CREATE TRIGGER(7)