Sponsored Content
Top Forums Programming Dynamically checking rules in database tables using SQL Post 302846531 by figaro on Saturday 24th of August 2013 12:36:53 PM
Old 08-24-2013
Yes, I was contemplating the export and then an import also. I see that more of a last resort option, because it involves writing to a file together with all its shortcomings.

The other solution we are investigating is through the use of cursors. This looks roughly as follows:
- create a list of all tables in the schema
- loop through these tables to create a list of all columns per table which are not keys
- loop through these columns to pick up rows where all values are NULL

Disadvantage here is that it requires the use of a procedural language as well as being less portable to other database systems.

Are you saying it is impossible to do entirely within MySQL in (possibly nested) SQL statements?
 

8 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

writing database tables into a file in unix

I want to collect the database tables(Ex: Emp,Sal,Bonus...etc) in a file & give this file at the command prompt, when prompted for the tables list at command prompt. How can i do that ? Ex:- Import jason/jason1 tables=emp,sal,bonus log=j1.log i want to change this into Ex:- Import... (3 Replies)
Discussion started by: dreams5617
3 Replies

2. Shell Programming and Scripting

Automating back up of database tables

Hi all, i would like to set a cronjob to back up my db tables. I have written the par file, i would like to know how can i execute a exp command in a shell script. my par file userid=admin/password file=backup.dmp log=backupLOG.log tables= (Tables 1, Tables 2)My cron job script will be... (1 Reply)
Discussion started by: new2ss
1 Replies

3. Shell Programming and Scripting

Tables to query to find users for database from shell script

I am coding shell script. I need to connect to different databases like DB2, Oracle and Sybase. I would then need to query tables where it has all the groups, users for that database. I would also need who has what kind of permissions. EG: I know for DB2 some TABAUTH table needs to be... (0 Replies)
Discussion started by: pinnacle
0 Replies

4. Programming

SQL Add to Multiple Tables

I'm pretty new to the database world and I've run into a mental block of sorts. I've been unable to find the answer anywhere. Here's my problem: I have several tables and everything is as normalized as possible (as I've been lead to understand normalization.) Normalization has lead to some... (1 Reply)
Discussion started by: flakblas
1 Replies

5. Shell Programming and Scripting

Passing filename dynamically in SPOOL of SQL*PLUS in shell script

Hi all, I am executing shell script in which I am using SQLLDR In this SQLLDR I am passing text file having PL/SQL script. This script will produce some formated output, this output I have to spool in another text file. Currently I have given this in script file as following Spool... (2 Replies)
Discussion started by: shekharjchandra
2 Replies

6. Programming

Query to join two tables in SQL

Hi, I have 2 tables. Table1 name map_code data_code id aaa 2732C 3333B 10 bbb 1223F 2545v 11 ccc 12 Table2 name map_code data_code id text_description aaa 2732C 3333B 10 description 1 bbb 1223F 2545v 11 ... (3 Replies)
Discussion started by: vanitham
3 Replies

7. Shell Programming and Scripting

Help with database checking script

I haven't coded in ksh in forever and this script is proving me not a great coder. I keep getting unexpected end of file when I try to execute this...Line 94 is the last line of the code.. #!/usr/bin/ksh . /home/oraprod/.bash_profile DBSID=prod # Database sid CONNECTSTR=apps/xxxxxxxx@prod #... (6 Replies)
Discussion started by: kirkladb
6 Replies

8. UNIX for Advanced & Expert Users

Identify tables from Oracle sql scripts

Hi, Please let me know if you have any thoughts on how to read a table that has all the oracle sql files or shell scripts at the job and step level to identify all the tables that does merge, update, delete, insert, create, truncate, alter table (ALTER TABLE XYZ RENAME TO ABC) and call them out... (1 Reply)
Discussion started by: techmoris
1 Replies
SQL::Translator::Parser::DBIx::Class(3) 		User Contributed Perl Documentation		   SQL::Translator::Parser::DBIx::Class(3)

NAME
SQL::Translator::Parser::DBIx::Class - Create a SQL::Translator schema from a DBIx::Class::Schema instance SYNOPSIS
## Via DBIx::Class use MyApp::Schema; my $schema = MyApp::Schema->connect("dbi:SQLite:something.db"); $schema->create_ddl_dir(); ## or $schema->deploy(); ## Standalone use MyApp::Schema; use SQL::Translator; my $schema = MyApp::Schema->connect; my $trans = SQL::Translator->new ( parser => 'SQL::Translator::Parser::DBIx::Class', parser_args => { package => $schema, add_fk_index => 0, sources => [qw/ Artist CD /], }, producer => 'SQLite', ) or die SQL::Translator->error; my $out = $trans->translate() or die $trans->error; DESCRIPTION
This class requires SQL::Translator installed to work. "SQL::Translator::Parser::DBIx::Class" reads a DBIx::Class schema, interrogates the columns, and stuffs it all in an $sqlt_schema object. Its primary use is in deploying database layouts described as a set of DBIx::Class classes, to a database. To do this, see "deploy" in DBIx::Class::Schema. This can also be achieved by having DBIx::Class export the schema as a set of SQL files ready for import into your database, or passed to other machines that need to have your application installed but don't have SQL::Translator installed. To do this see "create_ddl_dir" in DBIx::Class::Schema. PARSER OPTIONS
add_fk_index Create an index for each foreign key. Enabled by default, as having indexed foreign key columns is normally the sensible thing to do. sources Arguments: @class_names Limit the amount of parsed sources by supplying an explicit list of source names. SEE ALSO
SQL::Translator, DBIx::Class::Schema AUTHORS
See "CONTRIBUTORS" in DBIx::Class. LICENSE
You may distribute this code under the same terms as Perl itself. perl v5.16.2 2012-08-16 SQL::Translator::Parser::DBIx::Class(3)
All times are GMT -4. The time now is 10:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy