10 More Discussions You Might Find Interesting
1. Programming
Hello All,
I hope I'm posting this in the right section.
I have zero sql query writing skill, in fact, I've never done it before, but for some reason, a request came across my desk to get information from one of our databases. I have about 200 ticket numbers that have no information attached,... (8 Replies)
Discussion started by: bbbngowc
8 Replies
2. Programming
Hi All ,
I have tried many times am getting syntax error on 'UNION'
can anybody tell me ...
INSERT INTO table1
(
Type
, num_items
, num_letters
, total_value
)
(select
type='1',
num_items,
num_letters=count(*),
total_value=sum(letter_value)
from
table2
where
num_items = 1 (1 Reply)
Discussion started by: Venkatesh1
1 Replies
3. Shell Programming and Scripting
Hi, this's Pom. I'm quite a new one for shell script but I have to do sql on shell script to query some information from database.
I found a concern to get a new line...When I run my script, it retrieves all data as wondering but it's shown in one line :(
What should I do? I'm not sure that... (2 Replies)
Discussion started by: Kapom
2 Replies
4. Shell Programming and Scripting
I used the following code
code
select * from tablename where columnname
Instead of printing the expected output it prints all the files in the present directory since there is a "*" in the code. Is there any way to overcome the problem?
Thanks
Ananth (2 Replies)
Discussion started by: Ananthdoss
2 Replies
5. Shell Programming and Scripting
Hi Everyone,
Can anyone pls help me out......with my requirement, i am struggling since 3 days. Please find the requirement below
my file contains below data
R1|Array/Network Resistor - VIP|V_RES_CLASS|V_MOUNT_FEATURE|SURFACE MOUNT|AND|8533.10.00.20|8533.10.00.20|
R1|Array/Network Resistor... (9 Replies)
Discussion started by: jam_prasanna
9 Replies
6. Shell Programming and Scripting
Hi ,
I used the below script to get the sql data into csv file using unix scripting.
I m getting the output into an output file but the output file is not displayed in a separe columns .
#!/bin/ksh
export FILE_PATH=/maav/home/xyz/abc/
rm $FILE_PATH/sample.csv
sqlplus -s... (2 Replies)
Discussion started by: Nareshp
2 Replies
7. Shell Programming and Scripting
Hi,
I am passing an argument for the script and that argument values should exist in database.
bill_period_input="'""$1""'"
bill_period=`sqlplus uname/pwd@dbname <<eof!
set verify off
set heading off
set feedback off
select bill_period from bill_period_ref where... (4 Replies)
Discussion started by: ss_ss
4 Replies
8. UNIX and Linux Applications
Hello Everyone,
I am looking to write a script that will run on many machines in a network at the same time. They need to write a result to a common location. I plan to use a SQLlite database as this common writing point. But the concern I have is how SQLlite will react to multiple writes that... (1 Reply)
Discussion started by: garric
1 Replies
9. Shell Programming and Scripting
Hi ...
I am doing a switch user and then rsh and then running a sql query .
I am successfull in rsh and logging into the database , but my query doesnt run ..
Here's the command :
su - linus -c "rsh -l linus psmf ORACLE_SID=SMP;export ORACLE_SID;sqlplus... (1 Reply)
Discussion started by: sars
1 Replies
10. Shell Programming and Scripting
I have a script that looks for all jobs that contain a particular calendar.
Some of the calendars have '&' in them and sql freaks out when it encounters that.. is there a way around this?
I have tried:
select job_name from job where run_calendar='1&15dom'
select job_name from job... (3 Replies)
Discussion started by: Lindarella
3 Replies
SQL::Translator::Schema(3pm) User Contributed Perl Documentation SQL::Translator::Schema(3pm)
NAME
SQL::Translator::Schema - SQL::Translator schema object
SYNOPSIS
use SQL::Translator::Schema;
my $schema = SQL::Translator::Schema->new(
name => 'Foo',
database => 'MySQL',
);
my $table = $schema->add_table( name => 'foo' );
my $view = $schema->add_view( name => 'bar', sql => '...' );
DESCSIPTION
"SQL::Translator::Schema" is the object that accepts, validates, and returns the database structure.
METHODS
as_graph_pm
Returns a Graph::Directed object with the table names for nodes.
add_table
Add a table object. Returns the new SQL::Translator::Schema::Table object. The "name" parameter is required. If you try to create a
table with the same name as an existing table, you will get an error and the table will not be created.
my $t1 = $schema->add_table( name => 'foo' ) or die $schema->error;
my $t2 = SQL::Translator::Schema::Table->new( name => 'bar' );
$t2 = $schema->add_table( $table_bar ) or die $schema->error;
drop_table
Remove a table from the schema. Returns the table object if the table was found and removed, an error otherwise. The single parameter can
be either a table name or an "SQL::Translator::Schema::Table" object. The "cascade" parameter can be set to 1 to also drop all triggers on
the table, default is 0.
$schema->drop_table('mytable');
$schema->drop_table('mytable', cascade => 1);
add_procedure
Add a procedure object. Returns the new SQL::Translator::Schema::Procedure object. The "name" parameter is required. If you try to
create a procedure with the same name as an existing procedure, you will get an error and the procedure will not be created.
my $p1 = $schema->add_procedure( name => 'foo' );
my $p2 = SQL::Translator::Schema::Procedure->new( name => 'bar' );
$p2 = $schema->add_procedure( $procedure_bar ) or die $schema->error;
drop_procedure
Remove a procedure from the schema. Returns the procedure object if the procedure was found and removed, an error otherwise. The single
parameter can be either a procedure name or an "SQL::Translator::Schema::Procedure" object.
$schema->drop_procedure('myprocedure');
add_trigger
Add a trigger object. Returns the new SQL::Translator::Schema::Trigger object. The "name" parameter is required. If you try to create a
trigger with the same name as an existing trigger, you will get an error and the trigger will not be created.
my $t1 = $schema->add_trigger( name => 'foo' );
my $t2 = SQL::Translator::Schema::Trigger->new( name => 'bar' );
$t2 = $schema->add_trigger( $trigger_bar ) or die $schema->error;
drop_trigger
Remove a trigger from the schema. Returns the trigger object if the trigger was found and removed, an error otherwise. The single parameter
can be either a trigger name or an "SQL::Translator::Schema::Trigger" object.
$schema->drop_trigger('mytrigger');
add_view
Add a view object. Returns the new SQL::Translator::Schema::View object. The "name" parameter is required. If you try to create a view
with the same name as an existing view, you will get an error and the view will not be created.
my $v1 = $schema->add_view( name => 'foo' );
my $v2 = SQL::Translator::Schema::View->new( name => 'bar' );
$v2 = $schema->add_view( $view_bar ) or die $schema->error;
drop_view
Remove a view from the schema. Returns the view object if the view was found and removed, an error otherwise. The single parameter can be
either a view name or an "SQL::Translator::Schema::View" object.
$schema->drop_view('myview');
database
Get or set the schema's database. (optional)
my $database = $schema->database('PostgreSQL');
is_valid
Returns true if all the tables and views are valid.
my $ok = $schema->is_valid or die $schema->error;
get_procedure
Returns a procedure by the name provided.
my $procedure = $schema->get_procedure('foo');
get_procedures
Returns all the procedures as an array or array reference.
my @procedures = $schema->get_procedures;
get_table
Returns a table by the name provided.
my $table = $schema->get_table('foo');
get_tables
Returns all the tables as an array or array reference.
my @tables = $schema->get_tables;
get_trigger
Returns a trigger by the name provided.
my $trigger = $schema->get_trigger('foo');
get_triggers
Returns all the triggers as an array or array reference.
my @triggers = $schema->get_triggers;
get_view
Returns a view by the name provided.
my $view = $schema->get_view('foo');
get_views
Returns all the views as an array or array reference.
my @views = $schema->get_views;
make_natural_joins
Creates foriegn key relationships among like-named fields in different tables. Accepts the following arguments:
o join_pk_only
A True or False argument which determins whether or not to perform the joins from primary keys to fields of the same name in other
tables
o skip_fields
A list of fields to skip in the joins
$schema->make_natural_joins(
join_pk_only => 1,
skip_fields => 'name,department_id',
);
name
Get or set the schema's name. (optional)
my $schema_name = $schema->name('Foo Database');
translator
Get the SQL::Translator instance that instantiated the parser.
AUTHOR
Ken Youens-Clark <kclark@cpan.org>.
perl v5.14.2 2012-01-20 SQL::Translator::Schema(3pm)