Special copy in PL/SQL developer)

Source: Internet
Author: User

Special Copy in PL/SQL DEVELOPER)

-- Excerpt from PL/SQL syntax 6.0 Chinese PDF help manual

If you are using PL/SQL Developer to write SQL and PL/SQL code, then you need to use code in other tools, such as programming languages such as 3GL, you may need to convert the code to a slightly different format. Let's assume that you have written and tested such an SQL statement in PL/SQL Developer:

SelectDeptno,Sum(Sal) mgr_salFromEmp

WhereJob = 'manager'

GroupDeptno

OrderMgr_salDesc

For example, if you want to use this statement in Borland Delphi, you may need a format like this:

SQL: = 'select deptno, sum (sal) mgr_sal from emp' + #13 #10 +

'Where job = ''manager' + #13 #10 +

'Group by deptno' + #13 #10 +

'Order by mgr_sal desc ';

For this purpose, after right-clicking a selection in the editor, you can useEditMenu or from the pop-up menuDedicated ReplicationFunction. This feature has a sub menu that displays all the defined dedicated replication formats. After the format is selected, the converted code is stored on the clipboard, so that you can paste it into the editor of the corresponding tool. The dedicated replication format is defined in the SpecialCopy subdirectory under the PL/SQL Developer installation directory. You can change the pre-determined copy format or add a new copy format. Simply add. copy a text file with the extension. It contains a variable for the first line of PL/SQL code (<line_1>) A variable (<line_N>) for the last line of PL/SQL code and a variable (<line _ *>) for all other rows ). The following is an example of Borland Delphi:

; PL/SQL Developer SpecialCopy definition for Borland Delphi

; <Line_1> for first line

; <Line _ *> for all other lines

; <Line_N> for last line

;

SQL: = '<line_1>' + #13 #10 +

'<Line _ *>' + #13 #10 +

'<Line_n> ';

The first line needs to add a preface to the variables assigned to the SQL statement, followed by a CR/LF pair. The last line does not require a CR/LF pair, but must be terminated using a semicolon. All other rows must be followed by CR/LF. If both <line_1> and <line_n> are the same as <line _ *>, you can ignore them. In some languages, you need to use a conversion sequence for specific characters. For example, in C ++, you need to use "t" for the tab character (ASCII Code 9. To define these code-changing sequences, use the # define Keyword:

# Define char (9) = "t

# Define "= ""

String ("<line_1>" n ") +

String ("<line _ *>" n ") +

String ("<line_n> ");

You can also use "# define compress" to indicate that you want to remove all extra null characters (spaces, tabs, and line breaks) from the results ).

Note that the name of the. copy file will be included in the menu, so you should use descriptive file names.

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.