Sponsored Content
Full Discussion: Delete Script
Top Forums Shell Programming and Scripting Delete Script Post 302847577 by anita81 on Tuesday 27th of August 2013 09:31:33 AM
Old 08-27-2013
Deleting from second table with keycolumn as a parameter

I can find out the common records but I need to pass these records as parameters when deleting from second table.And I can expect more than several 1000 records at a time. So using unix script how will I be able to pass these 1000 records in unix script?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Please (Delete script)

Hello everybody. Actually I would like to ask you who can I make delete commend by shell script to delete some files from anywhere in my director and send it to specific place but whit the PATH because if want to restore it will return to the original place which I delete it from (As recycle pan... (7 Replies)
Discussion started by: falm
7 Replies

2. Shell Programming and Scripting

perl script to check if empty files are created and delete them and run a shell script

I have a local linux machine in which the files are dumped by a remote ubuntu server. If the process in remote server has any problem then empty files are created in local machine. Is there any way using perl script to check if the empty files are being created and delete them and then run a shell... (2 Replies)
Discussion started by: hussa1n
2 Replies

3. Shell Programming and Scripting

script to delete one digit.

Hi User, I have a text file with a lot of customer records (over 10,000). Each record contained one field called "charge" and it must start with some space (each record may have 15 space, 17 spece, 9 space,etc, then start with <charge> and end with </charge>, in between is a value. How can I... (3 Replies)
Discussion started by: happyv
3 Replies

4. Linux

Delete script

Hi I need a script that will remove the contents out of a common named folder on our server and all its contents. We have folder called temp which resides within several different folders and i need to delete the contents at a set time in the night thanks Treds (7 Replies)
Discussion started by: treds
7 Replies

5. Shell Programming and Scripting

Script to delete old directories

Hi, I have a requirement like, I need to create the directory with date and time stap (i.e YYYYMMDDHMS) every day end need to delete the old directories which is 12 months old. I have tested with following script cd /export/home/sbeeravo/; find . -type d -mtime +365 -exec rm -rf {} \; ... (2 Replies)
Discussion started by: ShirishaReddy
2 Replies

6. UNIX for Dummies Questions & Answers

script to delete old files

Hi, I want to delete files that are older than 60 days.... i need to execute the script in 7 differnt folders.... i can run the script in crontab to regularly check.... I am struck @ finding out how the file is 60 days old or not... Can u please help me on this? Thanks, NithZ (6 Replies)
Discussion started by: Nithz
6 Replies

7. Red Hat

Need Script to ZIP/SAVE & then DELETE Log file & DELETE ZIPS older than 12 months

ENVIROMENT Linux: Fedora Core release 1 (Yarrow) iPlanet: iPlanet-WebServer-Enterprise/6.0SP1 Log Path: /usr/iplanet/servers/https-company/logs I have iPlanet log rotation enabled rotating files on a daily basis. The rotated logs are NOT compressed & are taking up too much space. I... (7 Replies)
Discussion started by: zachs
7 Replies

8. Shell Programming and Scripting

Files delete script

Friends, I had written a small script to delete files from deletefiles.txt file. However, I want to add one more piece to script, so as to check if the file(file abc) which was already deleted earlier exists in 'deletefiles.txt' file, script should comment out that "file abc doesnt exist". Can... (5 Replies)
Discussion started by: fop4658
5 Replies

9. Shell Programming and Scripting

Script needed to delete to the list of files in a directory based on last created & delete them

Hi My directory structure is as below. dir1, dir2, dir3 I have the list of files to be deleted in the below path as below. /staging/retain_for_2years/Cleanup/log $ ls -lrt total 0 drwxr-xr-x 2 nobody nobody 256 Mar 01 16:15 01-MAR-2015_SPDBS2 drwxr-xr-x 2 root ... (2 Replies)
Discussion started by: prasadn
2 Replies

10. Shell Programming and Scripting

SFTP Shell Script Get & Delete && Upload & Delete

Hi All, Do you have any sample script, - auto get file from SFTP remote server and delete file in remove server after downloaded. - only download specify filename - auto upload file from local to SFTP remote server and delete local folder file after uploaded - only upload specify filename ... (3 Replies)
Discussion started by: weesiong
3 Replies
Parse::Dia::SQL::Output::SQLite3(3pm)			User Contributed Perl Documentation		     Parse::Dia::SQL::Output::SQLite3(3pm)

NAME
Parse::Dia::SQL::Output::SQLite3 - Create SQL for SQLite version 3. SYNOPSIS
use Parse::Dia::SQL; my $dia = Parse::Dia::SQL->new(file => 'foo.dia', db => 'sqlite3'); print $dia->get_sql(); DESCRIPTION
This sub-class creates SQL for the SQLite database version 3. new The constructor. Object names in SQLite have no inherent limit. 60 has been arbitrarily chosen. _get_create_table_sql Generate create table statement for a single table using SQLite syntax: Includes class comments before the table definition. Includes autoupdate triggers based on the class comment. autoupdate triggers If the class comment includes a line like: <autoupdate:foo/> Then an 'after update' trigger is generated for this table which executes the statement foo for the updated row. Examples of use include tracking record modification dates ("<autoupdate:dtModified=datetime('now')/">) or deriving a value from another field ("<autoupdate:sSoundex=soundex(sName)/">) get_schema_drop Generate drop table statments for all tables using SQLite syntax: drop table {foo} if exists get_view_drop Generate drop view statments for all tables using SQLite syntax: drop view {foo} if exists _get_fk_drop Drop foreign key enforcement triggers using SQLite syntax: drop trigger {foo} if exists The automatically generated foreign key enforcement triggers are: See "_get_create_association_sql" for more details. constraint_name_bi_tr constraint_name_bu_tr constraint_name_buparent_tr constraint_name_bdparent_tr _get_drop_index_sql drop index statement using SQLite syntax: drop index {foo} if exists get_permissions_create SQLite doesn't support permissions, so supress this output. get_permissions_drop SQLite doesn't support permissions, so supress this output. _get_create_association_sql Create the foreign key enforcement triggers using SQLite syntax: create trigger {fkname}[_bi_tr|_bu_tr|_bdparent_tr|_buparent_tr] Because SQLite doesn't natively enforce foreign key constraints (see <http://www.sqlite.org/omitted.html>), we use triggers to emulate this behaviour. The trigger names are the default contraint name (something like child_table_fk_child_fkcolumn) with suffixes described below. {constraint_name} is the name of the association, either specified or generated. {child_table} is the name of the dependent or child table. {child_fkcolumn} is the field in the dependent table that hold the foreign key. {parent_table} is the name of the parent table. {parent_key} is the key field of the parent table. Before insert - Dependent Table constraint_name_bi_tr Before insert on the child table require that the parent key exists. create trigger {constraint_name}_bi_tr before insert on {child_table} for each row begin select raise(abort, 'insert on table {child_table} violates foreign key constraint {constraint_name}') where new.{child_fkcolumn} is not null and (select {parent_key} from {parent_table} where {parent_key}=new.{child_fkcolumn}) is null; end; Before update - Dependent Table constraint_name_bu_tr Before update on the child table require that the parent key exists. create trigger {constraint_name}_bu_tr before update on {table_name} for each row begin select raise(abort, 'update on table {child_table} violates foreign key constraint {constraint_name}') where new.{child_fkcolumn} is not null and (select {parent_key} from {parent_table} where {parent_key}=new.{child_fkcolumn}) is null; end; Before update - Parent Table constraint_name_buparent_tr Before update on the primary key of the parent table ensure that there are no dependent child records. Note that cascading updates don't work. create trigger {constraint_name}_buparent_tr before update on {parent_table} for each row when new.{parent_key} <> old.{parent_key} begin select raise(abort, 'update on table {parent_table} violates foreign key constraint {constraint_name} on {child_table}') where (select {child_fkcolumn} from {child_table} where {child_fkcolumn}=old.{parent_key}) is not null; end; Before delete - Parent Table constraint_name_bdparent_tr The default behaviour can be modified through the contraint (in the multiplicity field) of the association. Default (On Delete Restrict) Before delete on the parent table ensure that there are no dependent child records. create trigger {constraint_name}_bdparent_tr before delete on {parent_table} for each row begin select raise(abort, 'delete on table {parent_table} violates foreign key constraint {constraint_name} on {child_table}') where (select {child_fkcolumn} from {child_table} where {child_fkcolumn}=old.{parent_key}) is not null; end; On Delete Cascade Before delete on the parent table delete all dependent child records. create trigger {constraint_name}_bdparent_tr before delete on {parent_table} for each row begin delete from {child_table} where {child_table}.{child_fkcolumn}=old.{parent_key}; end; On Delete Set Null Before delete on the parent table set the foreign key field(s) in all dependent child records to NULL. create trigger {constraint_name}_bdparent_tr before delete on {parent_table} for each row begin update {child_table} set {child_table}.{child_fkcolumn}=null where {child_table}.{child_fkcolumn}=old.{parent_key}; end; TODO
Things that might get added in future versions: Mandatory constraints The current foreign key triggers allow NULL in the child table. This might use a keyword in the multiplicity field (perhaps 'required') or could check the 'not null' state of the child fkcolumn. Views Views haven't been tested. They might already work, but who knows... Other stuff Bugs etc perl v5.14.2 2011-02-15 Parse::Dia::SQL::Output::SQLite3(3pm)
All times are GMT -4. The time now is 10:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy