Search This Blog

Friday, May 7, 2010

Disable interactive prompts at SQL*Plus

Whenever we have ampersand "&" in our script, SQL Plus prompts for a value to be entered. There are several ways to avoid that prompt as discussed below

1) user chr(38) instead of &

SELECT 'I love SQL '||chr(38)||' PLSQL' from dual; 

2) Use & at the end just below the single quotes
SELECT 'I love SQL &'||' PLSQL' from dual;  

3) SET DEFINE OFF can be use to disable the prompt
SET DEFINE OFF
SELECT 'I love SQL & PLSQL ' from dual; 
SET DEFINE ON

0 Comments:

Copyright (c) All rights reserved. Presented by Suresh Vaishya