.sql file in perl


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers .sql file in perl
# 1  
Old 07-23-2010
.sql file in perl

Hi,

Can anybody help me to create .sql file in PERL.

Requiement:

while executing a query in perl script instead of writting a query output in to a file in .csv, is there a way to create directly .sql file. Please reply at the earliest.

Thanks for your support.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Pass perl array to SQL oracle

Hello, Could someone please suggest if there is a way to pass an perl array(pass @v_array) to SQL as in below eg : #!/usr/bin/perl @v_array = (1,2,4,5,6,8); $db_userid = 'ni71/ni711'; $bufTPO = qx{ sqlplus -s << EOF $db_userid set verify off set feedback off set... (1 Reply)
Discussion started by: arunshankar.c
1 Replies

2. Shell Programming and Scripting

Perl with Sql Server2005

Hi all, I am getting an issue in connecting perl with sql server 2005. I am unsing Padre as an IDE on Strawberry perl. Please help me about this matter (0 Replies)
Discussion started by: parthmittal2007
0 Replies

3. Shell Programming and Scripting

perl- oracle sql query

Hi, I am new to perl.How to query oracle database with perl??? Thanks (1 Reply)
Discussion started by: tdev457
1 Replies

4. Shell Programming and Scripting

PERL : Bind 2D array to SQL

Hi, I am in the need of doing a bulk insert via : SQL - INSERT INTO <table> (SELECT..) OR PLSQL Block - FORALL i IN 1 .. count INSERT INTO <table>(arrayname(i)) I have a 2D array in my perl code which has the rows to be bulk inserted. Is there a way to bind the 2D array to the SQL... (4 Replies)
Discussion started by: sinpeak
4 Replies

5. Shell Programming and Scripting

run sql query via perl script

Hello, If I run this command on the server it works. # dbc "update config set radio_enabled = 0;" how can I execute the same command in perl. I have defined the dbc path. Can any one please correct the last line. #!/usr/bin/perl #database path $dbc='/opt/bin/psql -Userver... (0 Replies)
Discussion started by: sureshcisco
0 Replies

6. Shell Programming and Scripting

How to use sql data file in unix csv file as input to an sql query from shell

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

Reading PL/SQL output online from perl??

Hi there, I got this situation at job. First i have a Perl script that connect to Oracle 10g and execute a package. That package execute severals transactions and must generate log about process status each interval of time. What i'm doing now is saving the plsql package log in an auxiliar... (4 Replies)
Discussion started by: jparra
4 Replies

8. Shell Programming and Scripting

Need help in printing a sql query in perl

Hi All, I have the following sql query select abcd from udbadm.log where xyz='1'. I have 16k queries similar to this with different values for xyz. I want to print the values of 'abcd' for each row. I have the following perl code, but not sure how i can print that particular... (1 Reply)
Discussion started by: userscript
1 Replies

9. UNIX for Dummies Questions & Answers

Execute PL/SQL function from Unix script (.sql file)

Hi guys, I am new on here, I have a function in oracle that returns a specific value: create or replace PACKAGE BODY "CTC_ASDGET_SCHED" AS FUNCTION FN_ASDSCHEDULE_GET RETURN VARCHAR2 AS BEGIN DECLARE ASDSchedule varchar2(6); ASDComplete... (1 Reply)
Discussion started by: reptile
1 Replies

10. Shell Programming and Scripting

Incorrect SQL query in perl

I the the following perl script, however it does not return anything. Did i form my syantax wrongly? $sth=$dbh->prepare("select a.rowid,a.* from Table1 a where a.field1 = \'$Indicator1\' and a.schedule = \'$Indicator2\' and a.lastdate <= sysdate"); $sth->execute() ... (1 Reply)
Discussion started by: new2ss
1 Replies
Login or Register to Ask a Question
OCI_FETCH(3)															      OCI_FETCH(3)

oci_fetch - Fetches the next row from a query into internal buffers

SYNOPSIS
bool oci_fetch (resource $statement) DESCRIPTION
Fetches the next row from a query into internal buffers accessible either with oci_result(3), or by using variables previously defined with oci_define_by_name(3). See oci_fetch_array(3) for general information about fetching data. PARAMETERS
o $statement -A valid OCI8 statement identifier created by oci_parse(3) and executed by oci_execute(3), or a REF CURSOR statement identifier. RETURN VALUES
Returns TRUE on success or FALSE if there are no more rows in the $statement. EXAMPLES
Example #1 oci_fetch(3) with defined variables <?php $conn = oci_connect('hr', 'welcome', 'localhost/XE'); if (!$conn) { $e = oci_error(); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); } $sql = 'SELECT location_id, city FROM locations WHERE location_id < 1200'; $stid = oci_parse($conn, $sql); // The defines MUST be done before executing oci_define_by_name($stid, 'LOCATION_ID', $locid); oci_define_by_name($stid, 'CITY', $city); oci_execute($stid); // Each fetch populates the previously defined variables with the next row's data while (oci_fetch($stid)) { echo "Location id $locid is $city<br> "; } // Displays: // Location id 1000 is Roma // Location id 1100 is Venice oci_free_statement($stid); oci_close($conn); ?> Example #2 oci_fetch(3) with oci_result(3) <?php $conn = oci_connect('hr', 'welcome', 'localhost/XE'); if (!$conn) { $e = oci_error(); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); } $sql = 'SELECT location_id, city FROM locations WHERE location_id < 1200'; $stid = oci_parse($conn, $sql); oci_execute($stid); while (oci_fetch($stid)) { echo oci_result($stid, 'LOCATION_ID') . " is "; echo oci_result($stid, 'CITY') . "<br> "; } // Displays: // 1000 is Roma // 1100 is Venice oci_free_statement($stid); oci_close($conn); ?> NOTES
Note Will not return rows from Oracle Database 12 c Implicit Result Sets. Use oci_fetch_array(3) instead. SEE ALSO
oci_define_by_name(3), oci_fetch_all(3), oci_fetch_array(3), oci_fetch_assoc(3), oci_fetch_object(3), oci_fetch_row(3), oci_result(3). PHP Documentation Group OCI_FETCH(3)