Silver Posted September 15, 2011 Share Posted September 15, 2011 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 More sharing options...
HartleySan Posted September 15, 2011 Share Posted September 15, 2011 I think Larry mentions that the delimiter has to be changed to avoid the meaning of the semicolon being doubled-up and confused by the SQL parser. As such, I think any delimiter that doesn't cause confusion is fine. Link to comment Share on other sites More sharing options...
Silver Posted September 15, 2011 Author Share Posted September 15, 2011 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 More sharing options...
Larry Posted September 15, 2011 Share Posted September 15, 2011 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 More sharing options...
Recommended Posts