Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 06-05-2012
sagar_1986's Avatar
Registered User
 
Join Date: Apr 2012
Posts: 57
Thanks: 10
Thanked 0 Times in 0 Posts
MySQL Call sql script

I want to call the sql query from UNIX..but how to set page size and other necessary parameters i don't know plz guide me how to do this
Sponsored Links
    #2  
Old 06-05-2012
Users Awaiting Email Confirmation
 
Join Date: Mar 2012
Posts: 57
Thanks: 6
Thanked 0 Times in 0 Posts
First create sql script using vi editor and the create shell script call you sql script in shell script if you want you can schedule in crontab (where you can schedule)
Some hints...


PHP Code:
$test.sql
set serveroutput on size 1000000 format wrap
set feedback off
set verify off
set 
echo off sqlprompt ""
set long 2000000000
set linesize 32767
set longchunksize 32767
set pagesize 0
set timing off
set trimout on
set trimspool on
set heading off
set termout on
----------Sql query.... 
Shell script:-

PHP Code:
$cat test.sh
CDATE
=`date +%d%m%Y`
export CDATE
echo $CDATE
. /home/oracle/.bash_profile
sqlplus username
/password @test.sql >> test$CDATE.txt 
Sponsored Links
    #3  
Old 06-05-2012
gary_w's Avatar
Registered User
 
Join Date: Oct 2010
Posts: 446
Thanks: 31
Thanked 96 Times in 88 Posts
You don't say what you want to do with the output, but here are a couple of ways. Search the site, there are lots of examples of this:
http://www.unix.com/shell-programmin...le-script.html
http://www.unix.com/shell-programmin...variables.html
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Running a script in system() call and want the script's output amio Shell Programming and Scripting 9 09-13-2010 02:02 AM
how to run script? call other script? su to another user? make a cron? instant000 Shell Programming and Scripting 15 11-23-2009 04:01 PM
call shell script from perl cgi script problem raksha.s Shell Programming and Scripting 2 03-25-2009 04:50 AM
Call a perl script inside a shell script chriss_58 Shell Programming and Scripting 3 12-01-2008 03:28 AM
here document to automate perl script that call script hogger84 Shell Programming and Scripting 3 10-22-2007 10:15 AM



All times are GMT -4. The time now is 05:08 AM.