0

Below is my shell script snippet. I want serviceVer output should be with quotes. Like '7.6.%'

Currently, it is coming as Output: 7.6.%

Expected => Output: '7.6.%'

    #!/bin/ksh
    serviceVer VARCHAR2(200) := '7.6.%';
    BEGIN

 DBMS_OUTPUT.put_line('Output: '|| serviceVer );
.......

Please help.

I tried with serviceVer VARCHAR2(200) := '\'7.6.%\'';

But looks like it is not correct...

l0b0
  • 55,365
  • 30
  • 138
  • 223
VJS
  • 2,891
  • 7
  • 38
  • 70

2 Answers2

0

The restriction comes from your database, not bash.

Maybe use:

serviceVer VARCHAR2(200) := ''''7.6.%'''';

Or better:

DBMS_OUTPUT.put_line('Output: ' || '''' || serviceVer || '''');

You can check:

Single quote in dbms_output statement?

Samarth
  • 627
  • 6
  • 13
  • Using Oracle. It needs single quotes – VJS Nov 23 '18 at 07:16
  • It is for oracle, yes. Did you tested or checked the other link ? Here is a list or syntax for what you need: https://livesql.oracle.com/apex/livesql/file/content_CIREYU9EA54EOKQ7LAMZKRF6P.html Try like this DBMS_OUTPUT.put_line('Output: ' || '''' || serviceVer || ''''); – Cosmin Constantinescu Nov 26 '18 at 06:21
0

here is a working example:

DECLARE
serviceVer VARCHAR2(200) := '7.6.%';
BEGIN
dbms_output.put_line('Output: '|| ''''||serviceVer||'''') ;
END ;

Tested on https://livesql.oracle.com/