Jump to content
Larry Ullman's Book Forums

Stored Procedures: Delimiter


Recommended Posts

In the book a stored procedure's DELIMITER and END both end with double dollar signs ($$), in some other sources I found them ending with double forward slashes (//). Are there any other signs/characters used for same? I also presume that such signs and characters have no inherent differences in what the stored procedure does. If there is any difference pertaining to the type of charcters/signs used after DELIMITER and END, we would appreciate knowing it.

Link to comment
Share on other sites

Thanks HartleySan. Since $$ and // are doing the job, they are certainly fine, however, I wanted to know if any other characters or signs besides $$, // could be used for the same purpose, and if there are any pros or cons or other differences in using $$ over //. This is simply not about why we use $$, //, but rather about whether or not there are differences in their usage. To give an example: both 'include' and 'require' do the same job (including a file into another), however, there is a difference when one is used over the other.

Link to comment
Share on other sites

You may be missing the point of the delimiter. Literally ANY character or character combination can be used. There is absolutely no difference in the usage between $$ and // or ?? or XY or whatever. It's just a two-character combination used to mark the end of a complete SQL command. The default delimiter is the semicolon. The delimiter gets changed for defining stored procedures so that the default semicolon does not pre-emptively end the command. You can use literally anything for a replacement delimiter with equal effectiveness. The only rule is to use something that wouldn't appear within the command itself, such as the semicolon, the asterisk, a comma, the letter F, and so forth.

Link to comment
Share on other sites

 Share

×
×
  • Create New...