Re: How to concat dynamic column alias using || on oracle PL/SQL?

From: Quanwen Zhao <quanwenzhao_at_gmail.com>
Date: Thu, 18 Nov 2021 21:14:58 +0800
Message-ID: <CABpiuuSh+LpHCsAq-QES89MkpdOGTx+beRgRjebhLTVXLYJUiQ_at_mail.gmail.com>



Thank you very much, Sayan and Dominic!

'' indicates that a pair of single quotation and they represents that the starting and ending of the text literal here my double quote is coincidenctally the text literal.

I can also consider using q'[......]' to do the assignment for the entire variable of VARCHAR2 v_sql.

Sayan's suggestion about gist.github.com is very great, I'll try it as well next time.

Best Regards
Quanwen Zhao

在 2021年11月18日星期四,Dominic Brooks <dombrooks_at_hotmail.com> 写道:
> You say you know that the column alias should be in double quotes, e.g.
as “10:30” but none of your examples provides code which actually produces this as an end result.
>
>
>
> e.g.
>
> create view v1 as
>
> select 1 as 10:30 from dual; --wrong
>
>
>
> vs
>
>
>
> create view v1 as
>
> select 1 as '10:30 ' from dual; --wrong
>
>
>
> vs
>
>
>
> create view v1 as
>
> select 1 as "10:30" from dual; --right
>
>
>
> I.e. in your pro_convert_rows_to_columns proc, you need the concatenation
of something like:
>
>
>
> || '"'||v_samp_time.sample_time|| '" '
>
>
>
> (single quote then double quote then single quote)
>
>
>
> Regards,
>
> Dominic
>
>
>
> Sent from Mail for Windows
>
>
>
> From: Quanwen Zhao
> Sent: 18 November 2021 09:32
> To: ORACLE-L
> Subject: How to concat dynamic column alias using || on oracle PL/SQL?
>
>
>
> Hello all 😊,
>
>
>
> Recently I encountered a very weird issue when writing a PL/SQL
procedure, here are some screenshots from the following links:
>
>
>
>

https://quanwenzhao.files.wordpress.com/2021/11/pro_convert_rows_to_columns_1.png
>
>

https://quanwenzhao.files.wordpress.com/2021/11/pro_convert_rows_to_columns_2.png
>
> https://quanwenzhao.files.wordpress.com/2021/11/test_demo.png
>
>

https://quanwenzhao.files.wordpress.com/2021/11/pro_convert_rows_to_columns_3.png
>
>

https://quanwenzhao.files.wordpress.com/2021/11/pro_convert_rows_to_columns_4.png
>
>
>
> Yes, I know a column alias must use a double quotes for special character
because my case is the character about TIME (just including hour and minute) like this, "10:30".
>
>
>
> Could you help me troubleshooting it? Thanks beforehand! 🙏
>
>
>
> Best Regards
>
> Quanwen Zhao
>
>

--
http://www.freelists.org/webpage/oracle-l
Received on Thu Nov 18 2021 - 14:14:58 CET

Original text of this message