how to put quotes ina .sql file


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users how to put quotes ina .sql file
# 1  
Old 06-08-2007
how to put quotes ina .sql file

Hi i am new on Unix..........
I have to write a ddl and for tables and I am using single quotes in the comment for the table and its column...........but when i see on the unix server the ' dont show .

e.g. DROP TABLE DMR_PURGED;

CREATE TABLE DMR_PURGED
(
HEALTH_SERVICE_ID NUMBER(20) NOT NULL,
HEALTH_SERVICE_ITEM_NO NUMBER(2) NOT NULL,
SYSTEM_CD VARCHAR(2) NOT NULL,
PURGED_DT DATE NOT NULL,
REC_CREATE_TIMESTAMP DATE NOT NULL
);

COMMENT ON TABLE DMR_PURGED IS 'This stores purged member claims from PBS';

COMMENT ON COLUMN DMR_PURGED.HEALTH_SERVICE_ID IS 'Health Service ID';

COMMENT ON COLUMN DMR_PURGED.HEALTH_SERVICE_ITEM_NO IS 'Health Service Item Number';

COMMENT ON COLUMN DMR_PURGED.SYSTEM_CD IS 'System Code';

COMMENT ON COLUMN DMR_PURGED.PURGED_DT IS 'Purged Date';

COMMENT ON COLUMN DMR_PURGED.REC_CREATE_TIMESTAMP IS 'Record Create Timestamp';


CREATE OR REPLACE TRIGGER TRG_DMR_PURGED_TS
BEFORE UPDATE OR INSERT
ON DMR_PURGED
FOR EACH ROW
BEGIN

the comment line quotes either dont show or comes out as special character........plz help
# 2  
Old 06-08-2007
How are you composing the file?

If you edit the file on the UNIX box with vi does the problem go away?
# 3  
Old 06-08-2007
[QUOTE=agarwalniru]Hi i am new on Unix..........
I have to write a ddl and for tables and I am using single quotes in the comment for the table and its column...........but when i see on the unix server the ' dont show .

Ran this code -

more run.ksh

sqlplus <<ENDIT
$(cat $HOME/.dw_plus_logon.sec)

CREATE TABLE DMR_PURGED
(
HEALTH_SERVICE_ID NUMBER(20) NOT NULL,
HEALTH_SERVICE_ITEM_NO NUMBER(2) NOT NULL,
SYSTEM_CD VARCHAR(2) NOT NULL,
PURGED_DT DATE NOT NULL,
REC_CREATE_TIMESTAMP DATE NOT NULL
);

COMMENT ON TABLE DMR_PURGED IS 'This stores purged member claims from PBS';

COMMENT ON COLUMN DMR_PURGED.HEALTH_SERVICE_ID IS 'Health Service ID';

COMMENT ON COLUMN DMR_PURGED.HEALTH_SERVICE_ITEM_NO IS 'Health Service Item Number';

COMMENT ON COLUMN DMR_PURGED.SYSTEM_CD IS 'System Code';

COMMENT ON COLUMN DMR_PURGED.PURGED_DT IS 'Purged Date';

COMMENT ON COLUMN DMR_PURGED.REC_CREATE_TIMESTAMP IS 'Record Create Timestamp';



quit
ENDIT

-------------------------------------------------------------------------
Looks like it worked - I saw these results -

select * from user_col_comments
where table_name like 'DMR%'

TABLE_NAME COLUMN_NAME COMMENTS

DMR_PURGED HEALTH_SERVICE_ID Health Service ID
DMR_PURGED HEALTH_SERVICE_ITEM_NO Health Service Item Number
DMR_PURGED SYSTEM_CD System Code
DMR_PURGED PURGED_DT Purged Date
DMR_PURGED REC_CREATE_TIMESTAMP Record Create Timestamp
------------------------------------------------------------------

But there may be parameters you need to check - like some of the NLS parameters in Oracle.
# 4  
Old 06-08-2007
Quote:
Originally Posted by porter
How are you composing the file?

If you edit the file on the UNIX box with vi does the problem go away?

thats the whole problem......i m trying to edit it via Vi editor on unix and it doesnt let me edit.
so i making the changes ona notepad and FTP on unix....it still gives special characters in place of quotes
# 5  
Old 06-08-2007
the DBA got back to me saying that fo rthem it showed special chracters instead of quotes in the comment line........actually i created this doc in notepad an dthen FTP on unix server
# 6  
Old 06-09-2007
Quote:
Originally Posted by agarwalniru
thats the whole problem......i m trying to edit it via Vi editor on unix and it doesnt let me edit.
so i making the changes ona notepad and FTP on unix....it still gives special characters in place of quotes
On the unix machine try:
tr -d '\r' < file.txt > file
# 7  
Old 06-09-2007
Agarwalniru,
If you have the text in Notepad, the quick solution is to just
copy and paste it to unix vi.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove pipe(|) symbol ina file, except the ones which are enclosed in double quotes

I have file with are delimited by pipe(|) symbol, I wanted those to be removed except the ones which are enclosed in double quotes. If your quote file is: |Life is |Beautiful"|"Indeed life |is beautiful too|"|"But unix is fun| is not"|" It should return: Life is Beautiful"|"Indeed life is... (1 Reply)
Discussion started by: Sathyapts
1 Replies

2. Shell Programming and Scripting

Issue with quotes when running SQL command from within su -c

RHEL 6.2/Bash shell root user will be executing the below script. It switches to oracle user logs in using sqlplus and tries to run the below UPDATE statement. All the commands after su -c are enclosed in a single quote delimited by semicolon. The execution has failed because the quotes... (3 Replies)
Discussion started by: omega3
3 Replies

3. Shell Programming and Scripting

Put double quotes around numbers

Hi, consider a file which has data such as "random text",912345,"54","finish" "random text",9991236745,"9954","finish" I want to replace the numbers that don't have double quotes around them with ones that do; so the output should be "random text","912345","54","finish" "random... (4 Replies)
Discussion started by: Storms
4 Replies

4. Programming

Macro to put single quotes around character

Dear Mates, I am trying to write a macro to replace with its arguments with singles quotes around each argument. #define DECR(a,b,c,d,e) decr('a','b','c','d','e') if the usage is DECR(k,e,y,s,\0) I want it to be replaced with the following decr('k','e','y','s','\0') However it... (2 Replies)
Discussion started by: tamil.pamaran
2 Replies

5. Programming

How to put variable date from SQL Script

Hi Guys, Can someone please help me on adding/inserting a variable to an sql scipt? Basically I want to assign today's date. As shown below.. set head off; set linesize 300; set pagesize 200; spool /opt/oracle/temp/output.txt select value,count(*) as totalcount from pmowner.pinpebasev... (11 Replies)
Discussion started by: pinpe
11 Replies

6. Shell Programming and Scripting

How can i use single quotes for SQL command in shell script

Hi. please help me to write the following query in a shell script. the Query is :select no,salary from emp_info where name='$var_name' the following is my code. #! /bin/sh var_name=$1 sqlplus -s user/pwd@DB << EOF select no,salary from emp_info where name="'$var_name'";... (4 Replies)
Discussion started by: little_wonder
4 Replies

7. Shell Programming and Scripting

put value of multiple sql statements into unix variables

i want to use multple sql count statements and store these count values in unix variable but in one connection only i.e. in only 1 time database should be hit ,which is the main requirement. (1 Reply)
Discussion started by: sw@pnil
1 Replies

8. Shell Programming and Scripting

Replacing the last data of each line ina file

Hi, I ahve a file where the format is as given below: qqq dfsf gdfjkg gjdosjg jkflsjd 21 fdksdlf fsdnkfl lkdfsgjld 45 laefsdl fsdlfksl fsdklflk gfsdl 56 I need to replace the last number by space or delete the last number in each line. (by using... (6 Replies)
Discussion started by: jisha
6 Replies

9. Shell Programming and Scripting

Retreive content between specific lines ina file

Hi I have a text file which has two sets of lines repeating for "n" number of times.Some data is printed between the two lines.I want to retrieve all the data thats there in between those two set of lines.I have the string value of those two set of lines. To be much more clearer ... (4 Replies)
Discussion started by: chennaitomcruis
4 Replies

10. Shell Programming and Scripting

put double quotes for a column

Hi, I have a file which looks like this, I have stripped most of the columns: 2006,UCA,"02452","NM","1","M","84",123,aa 2006,UCA,"02452","NM","1","L","84",123,bb 2006,UCA,"02452","NM","1","L","84",432,cc 2006,UCA,"02452","NM","1","L","33",213,dd 2006,UCA,"02452","NM","1","L","33",124,ee... (3 Replies)
Discussion started by: sumeet
3 Replies
Login or Register to Ask a Question