Sponsored Content
Top Forums Shell Programming and Scripting Problem in formatting output of SQL query in excel sheet in shell script Post 302628117 by guruprasadpr on Monday 23rd of April 2012 02:35:47 AM
Old 04-23-2012
Hi

1. Regarding the fields not coming below the column title, the default linesize in sqlplus is 80. Looks your output line is more than 80 bytes. Set the linesize to a bigger value say 100. I mean, after the pagesize setting line, add the below line and check:

Code:
set linesize 100


2. Regarding the date formatting, I do not think you can format it like you do for a varchar or a number field. You need to change the NLS_DATE_FORMAT. To change NLS_DATE_FORMAT, you can google and see, you will find lots

Guru.
This User Gave Thanks to guruprasadpr For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to update existing excel sheet using shell script

Hi All, I am having an excel sheet with pre-defined format which our business team specified, what i need to do is i have to write a script which need to pick values from database and update specified cells in excel sheet.. can any one please help me in this regard.. I am able to pull the... (3 Replies)
Discussion started by: balanarendra
3 Replies

2. Shell Programming and Scripting

Filter data in Excel sheet using Shell Script

Hi, I have an excel sheet which has 100000 records. All these records are having 3 columns each with the last column as "Y" or "N". I would like to filter those records which has the value "Y". Can you please let me know how to proceed with that? Thanks in advance. -Sri ----------... (8 Replies)
Discussion started by: bhanusri83
8 Replies

3. Shell Programming and Scripting

Formatting the query output using shell script

Hi All, I'm finding it difficult to format the query output that was returned in a shell script. Actually i have one shell script which does some DB stuff and depending on the result it will do some more tasks. My question here is to format the query output returned by mysql. Intitally my... (5 Replies)
Discussion started by: RSC1985
5 Replies

4. Shell Programming and Scripting

sql select command output formatting in shell script

Hi, I need to connect to the database and retrieve two variables from the database and store them in a variable,out of these two variables I need to get lastdigit appended to the variable 1 retrieved and variable 2 with out any modification in short select var,data from usage; o/p=... (1 Reply)
Discussion started by: rkrish
1 Replies

5. Shell Programming and Scripting

Formatting Shell script output to Excel

I am facing a problem formatting the output of my shell script in excel. We are directing the output of the script to an excel sheet and need long integer type data printed in Excel as it is (i.e. not in the default scientific notation). Also, leading zeroes(if any) in the output are getting... (4 Replies)
Discussion started by: bornali.p
4 Replies

6. Shell Programming and Scripting

Adding tab to excel sheet with shell script

(1 Reply)
Discussion started by: sagar_1986
1 Replies

7. Shell Programming and Scripting

SQL Query in Shell Script output formatting

Hi All, #!/bin/ksh call_sql () { sql=$1 sqlplus -s $sqlparam_sieb <<EOF SET ECHO OFF; SET NEWPAGE NONE; SET SQLBL OFF; SET VERIFY OFF; SET LINESIZE 2000; SET... (2 Replies)
Discussion started by: Kevin Tivoli
2 Replies

8. Shell Programming and Scripting

Run sql query in shell script and output data save as delimited text

I want to run sql query in shell script and output data save as delimited text (delimited text would be comma) Code: SPOOL_FILE=/pgedw/dan.txt SQL=/pgedw/dan.sql sqlplus -s username/password@myhost:port/servicename <<EOF set head on set COLSEP , set linesize 32767 SET TRIMSPOOL ON SET... (8 Replies)
Discussion started by: Jaganjag
8 Replies

9. Shell Programming and Scripting

Shell script appending output of sql query

I am writing the following script to create the file v_out.txt. sqlplus -s /nolog << EOF CONNECT scott/tiger@orcl; whenever sqlerror exit sql.sqlcode; set newpage 0; SET PAGESIZE 0; SET ECHO OFF; SET FEEDBACK OFF; SET HEADING OFF; SET VERIFY OFF; SET LINESIZE 100; set tab off; set... (7 Replies)
Discussion started by: itzkashi
7 Replies

10. UNIX for Beginners Questions & Answers

Not able to write SQL query output in to .csv file with shell script.

I am trying to write SQL query output into a .csv file. But in the output columns are displaying in different lines instead of coming in one line. Main Code shell script: this is my code: #!/bin/bash file="db_detail.txt" . $file rm /batch/corpplan/bin/dan.csv... (6 Replies)
Discussion started by: sandeepgoli53
6 Replies
Convert::NLS_DATE_FORMAT(3pm)				User Contributed Perl Documentation			     Convert::NLS_DATE_FORMAT(3pm)

NAME
Convert::NLS_DATE_FORMAT - Convert Oracle NLS_DATE_FORMAT <-> strftime Format Strings SYNOPSIS
use Convert::NLS_DATE_FORMAT qw(oracle2posix posix2oracle); my $strptime = oracle2posix($NLS_DATE_FORMAT); $NLS_DATE_FORMAT = posix2oracle($strftime); DESCRIPTION
Convert Oracle's NLS_DATE_FORMAT string into a strptime format string, or the reverse. Functions oracle2posix Takes an Oracle NLS_DATE_FORMAT string and converts it into formatting string compatible with "strftime" or "strptime". my $format = oracle2posix('YYYY-MM-DD HH24:MI:SS'); # '%Y-%m-%d %H:%M:%S' Character sequences that should not be translated may be enclosed within double quotes, as specified in the Oracle documentation. my $format = oracle2posix('YYYY-MM-DD"T"HH24:MI:SS'); # '%Y-%m-%dT%H:%M:%S' posix2oracle Takes a "strftime" or "strptime" formatting string and converts it into an Oracle NLS_DATE_FORMAT string. It is possible to create strings which Oracle will not accept as valid NLS_DATE_FORMAT strings. my $format = posix2oracle('%Y-%m-%d %H:%M:%S'); # 'YYYY-MM-DD HH24:MI:SS' EXPORT None by default. "oracle2posix" and "posix2oracle" when asked. SEE ALSO
DateTime::Format::Oracle. AUTHOR
Nathan Gray, <kolibrie@cpan.org> COPYRIGHT AND LICENSE
Copyright (C) 2005, 2006, 2011, 2012 Nathan Gray This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available. perl v5.14.2 2012-01-18 Convert::NLS_DATE_FORMAT(3pm)
All times are GMT -4. The time now is 01:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy