Im very beginner in psql and i have a question.
Here is the code:
SET serveroutput ON
ACCEPT myVariable PROMPT \"Input value: \";
BEGIN
dbms_outpu
You have to specify the data type as part of the ACCEPT statement. If none is given, it assumes a number.
Try ACCEPT myVariable CHAR PROMPT 'Input value: ';
instead.
You don't have MYTEXT variable declared anywhere.
dbms_output.put_line('My input variable is: '||mytext); -- here is the error. It should be &myVariable.
You have to enclose the character substitution variable in quotes when you use it, if it's a string, otherwise Oracle tries to interpret the value as an object name. You can see that on the 'new' version (shown because you have set verify on
), and sexta13 alluded to that too. So you would do:
dbms_output.put_line('My input variable is: '||'&myVariable');
But you don't need to concatenate the value in this case (whether it's a number or s string):
dbms_output.put_line('My input variable is: &myVariable');