DOT(.) after Ampersand (host variable)& considering as a part of variable name?
I know heading is not so clear.This is the picture
I am using &a开发者_StackOverflowmp;a it is considering it as $a. ,in the output &a and &a. is giving the same output. and why single .(DOT) after &a is giving no error but if we put any character, operator or wild characters after &a gives error.
This is the code.
BEGIN
FOr i in &&a...3 LOOP
DBMS_OUTPUT.PUT_LINE(i||' '||&a.||' '||&a);
END LOOP;
END;
Output Coming
1 1 1
2 1 1
3 1 1
The dot is a delimiter for the &
define. In most cases you won't notice a difference, but if you for some reason didn't have whitespace or similar after the variable name it could cause confusion. For example, if you were concatenating something with your variable in a string, '&asomething'
, it would ask for a variable named 'asomething'. If you did it as '&a.something'
then it would ask for a variable named 'a' and tack 'something' on the end of whatever value is supplied. Any other character after the &a
would be treated as either part of the variable name or would cause an error if it isn't valid as part of the name.
精彩评论