The effect of sql-oracle in the realization of the column schema

Source: Internet
Author: User

In SQL Server, there is a function replicate () can implement the column chart effect, essentially using the number of occurrences of characters to control the length of the column chart, the effect

If you want to achieve the same effect within Oracle, you need to write a function yourself:

CREATE OR REPLACE FUNCTION kthis. REPLICATE (NO in number)
RETURN VARCHAR2
/**********************
Create by Yggdrasil
***************************/
As
V_return VARCHAR2 (500);
V_count number;
BEGIN
V_count:=1;
v_return:= ' = ';
IF No<0 Then
V_return:= ";
Elsif No<=1 Then
v_return:= ' = ';
Elsif No>1 Then
LOOP
v_count:=v_count+1;
SELECT v_return| | ' = ' into V_return from DUAL;
EXIT when v_count>no;
END LOOP;
END IF;
RETURN V_return;
END;
/

Then call the function to achieve the effect, you can simply display some data changes ^_^

The effect of sql-oracle in the realization of the column schema

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.