Sponsored Content
Full Discussion: Not able to insert data
Operating Systems Solaris Not able to insert data Post 302264795 by megh on Thursday 4th of December 2008 10:47:11 PM
Old 12-04-2008
Not able to insert data

Hi All,
I enhanced a perl script that creates a table with xyz_yyyymm and insert data from xyz table before truncate xyz.I have tested it successfully in dev but when i ran it on production new table xyz_yyyymm created but did not insert any records from xyz.(No errors were thrown)The perl ran successfully.

Can any one suggest what to do


$sql="select sys_value from syscntrl where sys_typ in ('EOM')";
exec_sql();
$eom=$sth->fetchrow_array();
$sql="create table acct_dnb_$eom unrecoverable as select * from acct_dnb";
exec_sql() ;
$sql="select count(*) from acct_dnb_$eom";
exec_sql();
$rows_returned=$sth->fetchrow_array();
sub exec_sql{
$sth=$dbh->prepare($sql) or mail_abort("dnb_portfolio.pl","cant prepare:\n$sql\n");
$sth->execute or mail_abort("dnb_portfolio.pl","\n$DBI::errstr\n$sql");
}

Regards
Megh

Last edited by megh; 12-05-2008 at 02:02 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed, insert data from a file to another?

Hello, I have 2 files. File1 has data I wrote, and File2 is a file created by an application. I would like to insert the data from File1 into File2, but it has to be inserted at a certain location on File2. I know I need to search for "</jsp-param> </jsp-descriptor>" But I don't know... (4 Replies)
Discussion started by: ctcuser
4 Replies

2. UNIX for Dummies Questions & Answers

help me to to insert data

hi, am new to unix can any one help me to insert data to afile to a specified column. ie to an output file with csv format i should insert some data to 2,3,4 fileds and the data in those fields should move to next fields eg: output file asd,12,12,12,12,1,2,1,1,1,1,1... (10 Replies)
Discussion started by: babu@shell
10 Replies

3. Shell Programming and Scripting

How to insert data befor some field in a row of data depending up on values in row

Hi I need to do some thing like "find and insert before that " in a file which contains many records. This will be clear with the following example. The original data record should be some thing like this 60119827 RTMS_LOCATION_CDR INSTANT_POSITION_QUERY 1236574686123083rtmssrv7 ... (8 Replies)
Discussion started by: aemunathan
8 Replies

4. Shell Programming and Scripting

Awk: Data Insert

Hi guys, I'm having some difficulties in insert some details to the following contents. I need to insert "TEST" under MIR & a value "25" to the next line. So far, I am able to insert "TEST" by using awk to capture MIR as the identifier. However, I am having some difficulties in inserting "25"... (3 Replies)
Discussion started by: nantheless
3 Replies

5. Shell Programming and Scripting

insert data into specific lines of a CSV

So I work in a 1 to 1 laptop deployment and sometimes we need to mass order parts. The vendor will send us a text file and we have to manually input serial numbers. Well I have a full blown web based inventory system which I can pull serial number reports from. I then have to input the part... (4 Replies)
Discussion started by: tlarkin
4 Replies

6. Shell Programming and Scripting

Insert and shifting data at column

Hi all, i have data like this joe : 1 :a bob : 2 :b sue : 3 :c foo : 4 :d at column 2 i want to insert TOP to the top column and at column 3 i want to insert BOTTOM to the bottom column. and the result will... (12 Replies)
Discussion started by: psychop13
12 Replies

7. UNIX for Dummies Questions & Answers

How to insert data in a file at last?

Hi Am Using Unix ksh... I have file name called FILE1 Have a content in a FILE as 11/01/2012 12/07/2012 -- -- I have used one variable DATE=12/11/2012 I wants to insert DATE variable value at last line in a file I need Output as cat FILE1 11/01/2012 12/07/2012 -- (2 Replies)
Discussion started by: Venkatesh1
2 Replies

8. Shell Programming and Scripting

Parsing XML (and insert data) then output data (bash / Solaris)

Hi folks I have a script I wrote that basically parses a bunch of config and xml files works out were to add in the new content then spits out the data into a new file. It all works - apart from the xml and config file format in the new file with XML files the original XML (that ends up in... (2 Replies)
Discussion started by: dfinch
2 Replies

9. Programming

Need help on Insert data to mySQL database

Hi guys, I would like to seek help on inserting data whenever the switch is on or off to my sensor mySQL database in phpMyAdmin from my control.php. I'm using Raspberry PI as my hardware and follow a few tutorials to create my own Web Control Interface, it works perfectly without insert method.... (1 Reply)
Discussion started by: aoiregion
1 Replies

10. Shell Programming and Scripting

Insert data based on pattern

if it is finding some data based on pattern 'test' then insert else if has no data based on the pattern 'test' then exit successfully cat file | grep test > file2 (3 Replies)
Discussion started by: jagu
3 Replies
Data::ObjectDriver::SQL(3pm)				User Contributed Perl Documentation			      Data::ObjectDriver::SQL(3pm)

NAME
Data::ObjectDriver::SQL - an SQL statement SYNOPSIS
my $sql = Data::ObjectDriver::SQL->new(); $sql->select([ 'id', 'name', 'bucket_id', 'note_id' ]); $sql->from([ 'foo' ]); $sql->add_where('name', 'fred'); $sql->add_where('bucket_id', { op => '!=', value => 47 }); $sql->add_where('note_id', 'IS NULL'); $sql->limit(1); my $sth = $dbh->prepare($sql->as_sql); $sth->execute(@{ $sql->{bind} }); my @values = $sth->selectrow_array(); my $obj = SomeObject->new(); $obj->set_columns(...); DESCRIPTION
Data::ObjectDriver::SQL represents an SQL statement. SQL statements are used internally to "Data::ObjectDriver::Driver::DBI" object drivers to convert database operations ("search()", "update()", etc) into database operations, but sometimes you just gotta use SQL. ATTRIBUTES
Data::ObjectDriver::SQL sports several data attributes that represent the parts of the modeled SQL statement. These attributes all have accessor and mutator methods. Note that some attributes have more convenient methods of modification (for example, "add_where()" for the "where" attribute). "select" (arrayref) The database columns to select in a "SELECT" query. "distinct" (boolean) Whether the "SELECT" query should return DISTINCT rows only. "select_map" (hashref) The map of database column names to object fields in a "SELECT" query. Use this mapping to convert members of the "select" list to column names. "select_map_reverse" (hashref) The map of object fields to database column names in a "SELECT" query. Use this map to reverse the "select_map" mapping where needed. "from" (arrayref) The list of tables from which to query results in a "SELECT" query. Note if you perform a "SELECT" query with multiple tables, the rows will be selected as Cartesian products that you'll need to reduce with "WHERE" clauses. Your query might be better served with real joins specified through the "joins" attribute of your statement. "joins" (arrayref of hashrefs containing scalars and hashrefs) The list of "JOIN" clauses to use in the table list of the statement. Each clause is a hashref containing these members: o "table" The name of the table in "from" being joined. o "joins" (arrayref) The list of joins to perform on the table named in "table". Each member of "joins" is a hashref containing: o "type" The type of join to use. That is, the SQL string to use before the word "JOIN" in the join expression; for example, "INNER" or "NATURAL RIGHT OUTER"). This member is optional. When not specified, the default plain "JOIN" join is specified. o "table" The name of the table to which to join. o "condition" The SQL expression across which to perform the join, as a string. "where" (arrayref) The list of "WHERE" clauses that apply to the SQL statement. Individual members of the list are strings of SQL. All members of this attribute must be true for a record to be included as a result; that is, the list members are "AND"ed together to form the full "WHERE" clause. "where_values" (hashref of variant structures) The set of data structures used to generate the "WHERE" clause SQL found in the "where" attributes, keyed on the associated column names. "bind" (arrayref) The list of values to bind to the query when performed. That is, the list of values to be replaced for the "?"es in the SQL. "limit" (scalar) The maximum number of results on which to perform the query. "offset" (scalar) The number of records to skip before performing the query. Combined with a "limit" and application logic to increase the offset in subsequent queries, you can paginate a set of records with a moving window containing "limit" records. "group" (hashref, or an arrayref of hashrefs) The fields on which to group the results. Grouping fields are hashrefs containing these members: o "column" Name of the column on which to group. Note you can set a single grouping field, or use an arrayref containing multiple grouping fields. "having" (arrayref) The list of clauses to specify in the "HAVING" portion of a "GROUP ... HAVING" clause. Individual clauses are simple strings containing the conditional expression, as in "where". "order" (hashref, or an arrayref of hashrefs) Returns or sets the fields by which to order the results. Ordering fields are hashrefs containing these members: o "column" Name of the column by which to order. o "desc" The SQL keyword to use to specify the ordering. For example, use "DESC" to specify a descending order. This member is optional. Note you can set a single ordering field, or use an arrayref containing multiple ordering fields. "$sql->comment([ $comment ])" Returns or sets a simple comment to the SQL statement USAGE
"Data::ObjectDriver::SQL->new()" Creates a new, empty SQL statement. "$sql->add_select($column [, $term ])" Adds the database column $column to the list of fields to return in a "SELECT" query. The requested object member will be indicated to be $term in the statement's "select_map" and "select_map_reverse" attributes. $term is optional, and defaults to the same value as $column. "$sql->add_join($table, @joins)" Adds the join statement indicated by $table and "@joins" to the list of "JOIN" table references for the statement. The structure for the set of joins are as described for the "joins" attribute member above. "$sql->add_index_hint($table, $index)" Specifies a particular index to use for a particular table. "$sql->add_where($column, $value)" Adds a condition on the value of the database column $column to the statement's "WHERE" clause. A record will be tested against the below conditions according to what type of data structure $value is: o a scalar The value of $column must equal $value. o a reference to a scalar The value of $column must evaluate true against the SQL given in $$value. For example, if $$value were "IS NULL", $column must be "NULL" for a record to pass. o a hashref The value of $column must compare against the condition represented by $value, which can contain the members: o "value" The value with which to compare (required). o "op" The SQL operator with which to compare "value" and the value of $column (required). o "column" The column name for the comparison. If this is present, it overrides the column name $column, allowing you to build more complex conditions like "((foo = 1 AND bar = 2) OR (baz = 3))". For example, if "value" were "NULL" and "op" were "IS", a record's $column column would have to be "NULL" to match. o an arrayref of scalars The value of $column may equal any of the members of @$value. The generated SQL performs the comparison with as an "IN" expression. o an arrayref of (mostly) references The value of $column must compare against any of the expressions represented in @$value. Each member of the list can be any of the structures described here as possible forms of $value. If the first member of the @$value array is the scalar string "-and", all subsequent members of <@$value> must be met for the record to match. Note this is not very useful unless contained as one option of a larger "OR" alternation. All individual conditions specified with "add_where()" must be true for a record to be a result of the query. Beware that you can create a circular reference that will recursively generate an infinite SQL statement (for example, by specifying a arrayref $value that itself contains $value). As "add_where()" evaluates your expressions before storing the conditions in the "where" attribute as a generated SQL string, this will occur when calling "add_where()", not "as_sql()". So don't do that. "$sql->add_complex_where(@list)" This method accepts an array reference of clauses that are glued together with logical operators. With it, you can express where clauses that mix logical operators together to produce more complex queries. For instance: [ { foo => 1, bar => 2 }, -or => { baz => 3 } ] The values given for the columns support all the variants documented for the "add_where()" method above. Logical operators used inbetween the hashref elements can be one of: '-or', '-and', '-or_not', '-and_not'. "$sql->has_where($column, [$value])" Returns whether a where clause for the column $column was added to the statement with the "add_where()" method. The $value argument is currently ignored. "$sql->add_having($column, $value)" Adds an expression to the "HAVING" portion of the statement's "GROUP ... HAVING" clause. The expression compares $column using $value, which can be any of the structures described above for the "add_where()" method. "$sql->add_index_hint($table, @hints)" Addes the index hint into a "SELECT" query. The structure for the set of "@hints" are arrayref of hashrefs containing these members: o "type" (scalar) The name of the type. "USE", "IGNORE or "FORCE". o "list" (arrayref) The list of name of indexes which to use. "$sql->as_sql()" Returns the SQL fully representing the SQL statement $sql. "$sql->as_sql_having()" Returns the SQL representing the "HAVING" portion of $sql's "GROUP ... HAVING" clause. "$sql->as_sql_where()" Returns the SQL representing $sql's "WHERE" clause. "$sql->as_limit()" Returns the SQL for the "LIMIT ... OFFSET" clause of the statement. "$sql->as_aggregate($set)" Returns the SQL representing the aggregation clause of type $set for the SQL statement $sql. Reasonable values of $set are "ORDER" and "GROUP". DIAGNOSTICS
o "Invalid/unsafe column name column" The column name you specified to "add_where()" contained characters that are not allowed in database column names. Only word characters and periods are allowed. Perhaps you didn't filter punctuation out of a generated column name correctly. BUGS AND LIMITATIONS
Data::ObjectDriver::SQL does not provide the functionality for turning SQL statements into instances of object classes. SEE ALSO
LICENSE
Data::ObjectDriver is free software; you may redistribute it and/or modify it under the same terms as Perl itself. AUTHOR &; COPYRIGHT Except where otherwise noted, Data::ObjectDriver is Copyright 2005-2006 Six Apart, cpan@sixapart.com. All rights reserved. perl v5.12.4 2011-08-29 Data::ObjectDriver::SQL(3pm)
All times are GMT -4. The time now is 07:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy