Sponsored Content
Top Forums Shell Programming and Scripting Line break in sqlplus output through ksh script Post 302995702 by Sumit Arora on Tuesday 11th of April 2017 02:06:57 AM
Old 04-11-2017
Below is the SQL:
Code:
SELECT &&1 || '|' || to_char(sysdate, 'YYYYMMDD') || 'T' ||
        to_char(sysdate, 'HH24MM') || '00' || '|' || item.segment1 || '|' || 'IM' || '|' ||
        substr(item.description, 1, 50) || '|' || item.primary_UOM_Code || '|' || case
          when item.unit_weight > 0 then
           item.unit_weight
          when item.unit_weight <= 0 then
           9999.9999
          else
           9999.999
        end || '|' || NVL(item.weight_uom_code, 'KG') || '|' || 0 || '|' ||
        'USD' || '|' || 'N' || '|' || '' || '|' || '' || '|' || 'E' || '|' || '' || '|' || '' || '|' ||
        replace(glo_buyer.agent_name, '''', '') || '|' || '' || '|' || case
          when length(hts.tariff_code) < 10 THEN
           '1111111111'
          when hts.tariff_code Is Null THEN
           '1111111111'
          else
           hts.tariff_code
        END || '|' || 'M' || '|' || 'XX' || '|' || 'MULTIPLE' || '|' || '' || '|' || case
          when cst.item_cost > 0 then
           cst.item_cost
          when lacst.item_cost > 0 then
           lacst.item_cost
        --when pendingcst.item_cost > 0 then pendingcst.item_cost
          else
           0
        end || '|' ||
       --cst.item_cost||'|'||
        0 || '|' || 'USD' || '|' || 0 || '|' || 0 || '|' || '' || '|' || 0 || '|' || 0 || '|' || '' || '|' || '' || '|' || '' || '|' || 0 || '|' || '' || '|' || 0 || '|' || '' || '|' ||
        glo_buyer.agent_name || '|' || '' || '|' || ''
  FROM apps.mtl_system_items_b item

(more conditions)

we are generating output in .txt format and viewing output in notepad.

Last edited by Don Cragun; 04-11-2017 at 03:28 AM.. Reason: Add CODE and ICODE tags, again.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ksh script: 'exit' being treated as 'break 2'

hi, in a korn shell script, has anyone ever seen an 'exit' being treated as a 'break 2'? I have a script which has 3 nested loops. Within the inner most loop, i'm trying to exit the script on a fault condition. instead of exiting, it's acting as a 'break 2' and then continuing on with the... (4 Replies)
Discussion started by: gsatch
4 Replies

2. Shell Programming and Scripting

Need help with ksh script that uses sqlplus, called from PHP

I have a ksh script that connects to sqlplus and dumps the query results into a file. The script works file when I run it from the command line, however, when I call it from PHP using system(), exec(), or shell_exec() commands, the script doesn't seem to run the query. It will create the text file... (7 Replies)
Discussion started by: j2owilson
7 Replies

3. Shell Programming and Scripting

How to pass variable to SQLPLUS in a ksh script?

Hi, I am writing a ksh script which will use sqlplus to run a sql and pass 2 variables as the SQL request. In the ksh script, I have 2 variables which are $min_snap and $max_snap holding 2 different numbers. Inside the same script, I am using SQLPLUS to run an Oracle SQL script,... (6 Replies)
Discussion started by: rwunwla
6 Replies

4. UNIX for Advanced & Expert Users

sqlPlus output with new line character

Hi, I have a script which calls a sqlplus command and i'm saving the output in a variable. Z=`sqlplus -s $TC_ORACLE_USER/$TC_ORACLE_PASSWORD@$TC_CONNECT_STRING <<eof set echo off set head off set serveroutput on; set feedback off; select description from period where trunc(sysdate)... (2 Replies)
Discussion started by: decci_7
2 Replies

5. Shell Programming and Scripting

KSH script to run other ksh scripts and output it to a file and/or email

Hi I am new to this Scripting process and would like to know How can i write a ksh script that will call other ksh scripts and write the output to a file and/or email. For example ------- Script ABC ------- a.ksh b.ksh c.ksh I need to call all three scripts execute them and... (2 Replies)
Discussion started by: pacifican
2 Replies

6. Solaris

sqlplus output from ksh.

Hi All, I have the below simple script. It runs just fine by itself when I manually invoke it. But once I put it in the crontab with entry: * * * * * /users/myuser/test.ksh >> /users/myuser/log/test.txt" It does NOT print the returned value ($REMAIN) from the DB!? The result in the... (3 Replies)
Discussion started by: steve701
3 Replies

7. Shell Programming and Scripting

Shell Script (ksh) - SQLPlus query filter using a string variable

Using ksh, I am using SQLPlus to execute a query with a filter using a string variable. REPO_DB=DEV1 FOLDER_NM='U_nmalencia' FOLDER_CHECK=$(sqlplus -s /nolog <<EOF CONNECT user/pswd_select@${REPO_DB} set echo off heading off feedback off select subj_name from subject where... (5 Replies)
Discussion started by: nkm0brm
5 Replies

8. Shell Programming and Scripting

Output result with break line

Hello, I am coding a script to check mysql databases using bash script, I would like to check if the status of a table is not 'OK', will return the table name and do some more actions: check.log table1 OK table2 Some error here table3 ... (5 Replies)
Discussion started by: Abu Rayane
5 Replies

9. UNIX for Beginners Questions & Answers

awk script for pattern match and line break

Hi, I have input which reads like 9089.00 ----- kl jkjjljk lkkk; (909099) 9097.00 ----- HGJJHHJ jcxkjlkjvhvlk jhdkjksdfkhfskd 898.00 ----- HHHH I am trying to do something like this - As soon as I found pattern match "XYZ.00-----" it will insert a line break to the input and will go to... (3 Replies)
Discussion started by: Indra2011
3 Replies

10. Shell Programming and Scripting

Oracle/SQLPlus help - ksh Script calling .sql file not 'pausing' at ACCEPT, can't figure out why

Hi, I am trying to write a script that calls an Oracle SQL file who in turns call another SQL file. This same SQL file has to be run against the same database but using different username and password at each loop. The first SQL file is basically a connection test and it is supposed to sort... (2 Replies)
Discussion started by: newbie_01
2 Replies
GoogleSyncMigrate(1)					    BSD General Commands Manual 				      GoogleSyncMigrate(1)

NAME
GoogleSyncMigrate, Other_name_for_same_program(), Yet another name for the same program. -- This line parsed for whatis database. SYNOPSIS
GoogleSyncMigrate, [-abcd] [-a path] [file] [file ...] arg0 arg2 ... DESCRIPTION
Use the .Nm macro to refer to your program throughout the man page like such: GoogleSyncMigrate, Underlining is accomplished with the .Ar macro like this: underlined text. A list of items with descriptions: item a Description of item a item b Description of item b A list of flags and their descriptions: -a Description of -a flag -b Description of -b flag FILES
/usr/share/file_name FILE_1 description /Users/joeuser/Library/really_long_file_name FILE_2 description SEE ALSO
a(1), b(1), c(1), a(2), b(2), a(3), b(3) Darwin May 31, 2019 Darwin
All times are GMT -4. The time now is 12:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy