On the problems of/**/annotation section in sqlplus worksheet (2004.12.15 essay)

Source: Internet
Author: User
Tags command line insert lowercase sqlplus
Problem
A particularly odd question was found today in Oracle 9i's Sqlplusworksheet, which looks like the following statement, which is to clear the Sys_object table, then insert3 the data in the table, and perform completely normal in the 5.7 version of Golden32:

/*====================*/
/*object Data * *
/*====================*/

Delete from Sys_object;

/*merchant*/
--merchant Group
INSERT INTO Sys_object ("object_id", "object_name", "menu_id", "object_type", "Object_user", "PROCESS", "Create_user", " Create_ts "," Item_seq "," Object_seq ") VALUES (' m_mercgr ', ' Merchant Group ', ' M_merc ', ' W ', ' A ', ' merchant/mercgr_ Browse.asp ', ' SYSTEM ', sysdate,3,4);

/*mps operation*/
INSERT INTO Sys_object ("object_id", "object_name", "menu_id", "object_type", "Object_user", "PROCESS", "Create_user", " Create_ts "," Item_seq "," Object_seq ") VALUES (' M_oper ', ' MPS Operation ', NULL, ' M ', ' A ', ', ' SYSTEM ', sysdate,2,5);
--payment Adjustment
INSERT INTO Sys_object ("object_id", "object_name", "menu_id", "object_type", "Object_user", "PROCESS", "Create_user", " Create_ts "," Item_seq "," Object_seq ") VALUES (' M_payadj ', ' Payment adjustment ', ' m_oper ', ' W ', ' A ', ' operation/payadj_ Browse.asp ', ' SYSTEM ', sysdate,1,6);
Commit

But when executed in Oracle 9i's Sqlplusworksheet, this is the hint:

3 rows have been deleted.


0 rows have been deleted.


1 lines have been created.

INSERT INTO Sys_object ("object_id", "object_name", "menu_id", "object_type", "Object_user", "PROCESS", "Create_user", " Create_ts "," Item_seq "," Object_seq ") VALUES (' m_mercgr ', ' Merchant Group ', ' M_merc ', ' W ', ' A ', ' merchant/mercgr_ Browse.asp ', ' SYSTEM ', sysdate,3,4)
*
ERROR is on line 1th:
ORA-00001: Violates a unique constraint (HYH. Pk_sys_object)



1 lines have been created.


1 lines have been created.


Submit completed.

I am depressed, the statement good why error, see error message is represented in the PK field insert duplicate value, think for a half-day, epiphany! Worksheet is clearly in Mongolia, the data I have delete, and my PK field is object_id field, there can be no duplication, and then look at the return of information, found the problem, I clearly wrote a DELETE statement, but returned two delete information, Did the delete execute two times? If it was executed two times, then the second execution of the time has no data, so delete 0, why do two times?

Then look at the code to find a problem:
After Delete is a comment block:/*merchant*/
Again the newspaper PK wrong line:
After that is also the comment block:/*mps operation*/
Is/**/a ghost?
OK, try it, change the two annotation blocks to--start, then run ...
, normal ..., really angry me, indeed is the problem of/**/, then why for this comment block no problem:
/*====================*/
/*object Data * *
/*====================*/
Note: There are other statements before this block.

Multiple tests found that/* behind the 26-letter comment block will cause worksheet to repeat the statement before the comment block again!
/* Uppercase and lowercase letters * *

In fact, it seems like this: this annotation/* Uppercase/lowercase Letter * * Enables Sqlplus worksheet to rerun the command line in the buffer!

I do not know what I wrote or I understand the right, anyway, my problem solved, if you have questions, try it yourself




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.