oracle 插入 VARCHAR2 列时的新行
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8036763/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
New Line while inserting into VARCHAR2 column
提问by gaurav
I have a requirement where i need to prepare data for email ,So i populate
data into column of table having VARCHAR2(4000) as definition, Now what i want, is to insert it into new line wherever i want to .
我有一个要求,我需要为电子邮件准备数据,所以我将
数据填充到以 VARCHAR2(4000) 作为定义的表列中,现在我想要的是将它插入到任何我想要的新行中。
begin
v_email := v_email ||--new line--??;
end;
Suppose i am preparing email text 'List of all blocked transaction id ' ..in one line 1)transaction_id ....in another lin e 2)transaction_id .....in another line.
假设我正在准备电子邮件文本“所有被阻止的交易 ID 列表”..在一行 1)transaction_id ....在另一行 2)transaction_id .....在另一行。
I am using oracle as rdbms .
我使用 oracle 作为 rdbms 。
回答by Rajesh Chamarthi
You could use the ASCII code and the CHR function to do this.
您可以使用 ASCII 代码和 CHR 函数来执行此操作。
Here's the entire list. http://www.asciitable.com/
这是整个列表。http://www.asciitable.com/
SQL> conn rc/rc@orcl102
Connected.
SQL> set serveroutput on;
SQL> begin
2 dbms_output.put_line('Hello..' || chr(10) || 'how are you...');
3 end;
4 /
Hello..
how are you...