I am writing an SQL procedure and trying to get the output.
My procedur works fine but the I have prb in displaying the output.
Here is the problematic code snippet:
FOR i in 1....lcount LOOP
if(i=lcount) then
dbms_output.put_line('The value is' || user_name);
else
dbms_output.put_line('The present value is' || user_name || 'and');
END IF;
END LOOP;
Here user_name is a string.
Now when I execute the procedure for one condition I get the output as:
The present value is 'User' and
The value is 'Answer'
PL/SQL procedure executed succesfully.
But I want the output as:
The present value is 'User' and The value is 'Answer'
Do anyone know how can I print the dbms.output line in one line instead of 2 seperate lines?
I do not want the else part's dbms output line to print in the next line. I want it in the same line.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Hey thanks. But how will I do that?
I have a condition that when it is inside if loop, I want a statement as 'The value is' and when it is inside else part I want it as 'The value is Usernmae and'. I do not want the 'and' appended for the last condition.
Can you please tell me how I will do that?
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Bookmarks