Cannot get literal ampersand to display in SQL output


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Cannot get literal ampersand to display in SQL output
# 1  
Old 07-11-2012
Cannot get literal ampersand to display in SQL output

Gurus,

Thanks so much for your help, in advance.

I'm using ksh and outputting a literal string value to an output file, however, Unix isn't playing by SQL's rules. The ampersand character which I'm trying to disply as a knowledge base link is screwing up the output. Typically, the "&&" is the escape for displaying "&" in SQL output, however, this doesn't work inside a shell script.

Does anyone know the escape characters to disply the ampersand properly for the following?

I've include double ampersand, as per SQL's rules...

col Instructions3 heading "KNOWLEDGE BASE SUPPORT LINK" format a4000
select 'http://vr05a2.us.com:86/viewtopic.php?f=141&&t=2057&&p=2334&&hilit=over+pick&&sid=56b38c52bf3b36f1d17b854b29a41a3b#p2334' Instructions3
from dual;

Thanks,
Scott
# 2  
Old 07-11-2012
The output has to be in text surrounded by quotes - single or double -- && is a keyword in shell
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Storing multiple sql queries output into variable by running sql command only once

Hi All, I want to run multiple sql queries and store the data in variable but i want to use sql command only once. Is there a way without running sql command twice and storing.Please advise. Eg : Select 'Query 1 output' from dual; Select 'Query 2 output' from dual; I want to... (3 Replies)
Discussion started by: Rokkesh
3 Replies

2. Programming

SQL*PLUS How to display a count of 0

Hi, I have been frantically googling and checking some sqlplus forums, but can't find the correct syntax. Basically within sqlplus I want to do a count on a table and if the count is 0 it displays 0 instead of "no rows found". For eample: select count(*) from tableA where... (3 Replies)
Discussion started by: chris01010
3 Replies

3. Shell Programming and Scripting

sed Ampersand

I want to add the character "<" to the end of each line of input using the & function in SED. Something like: sed 's/.*/&\</' It's important to use the &, not another method, because I want to know what I'm doing wrong. Thanks (5 Replies)
Discussion started by: rlopes
5 Replies

4. Shell Programming and Scripting

Display the output

Hi, I have the following output of a shell script k m == -77.2820 (Act=79.9) i want to display only k m (6 Replies)
Discussion started by: sreejithalokkan
6 Replies

5. Shell Programming and Scripting

Awk script to run a sql and print the output to an output file

Hi All, I have around 900 Select Sql's which I would like to run in an awk script and print the output of those sql's in an txt file. Can you anyone pls let me know how do I do it and execute the awk script? Thanks. (4 Replies)
Discussion started by: adept
4 Replies

6. UNIX for Advanced & Expert Users

v$sql not display correct sql_text

Hi folks, I am facing one problem with v$sql, i need to store updating sql query in temp table when one trigger get fired on some update sql statement. but with "sql_text" , i am not getting correct update statement in temp table. I am getting sql_text with this cursor statement. select... (0 Replies)
Discussion started by: apskaushik
0 Replies

7. Shell Programming and Scripting

How to display fields and values in sql+ for Oracle DB

Hello, I'm trying to do a select for an Oracle table but the output gives me only filelds values without fields name as in Informix. Is there anyway to display both in output ? For instance, the output will be : Name Rico Age 30 Position Engineer Thx, (5 Replies)
Discussion started by: rany1
5 Replies

8. UNIX for Dummies Questions & Answers

Command display output on console and simultaneously save the command and its output

Hi folks, Please advise which command/command line shall I run; 1) to display the command and its output on console 2) simultaneous to save the command and its output on a file I tried tee command as follows; $ ps aux | grep mysql | tee /path/to/output.txt It displayed the... (7 Replies)
Discussion started by: satimis
7 Replies

9. Programming

The Ampersand

In my program, I'm using argc and argv to accept command line arguments. However, if I have to get the '&' to work i.e. make it run the child as a background process, do I have to write some special code in C or does Unix handle it automatically? If I have to add the special code, how does it look... (2 Replies)
Discussion started by: Legend986
2 Replies

10. UNIX for Dummies Questions & Answers

ampersand

What is the & for in Unix?? say for example that you have a line in a shellscript that will startup a executable and you have the ampersand at the end of the line, what is it for?? any info you could spare would be much appreciated thanks in advance (1 Reply)
Discussion started by: eloquent99
1 Replies
Login or Register to Ask a Question