List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:September 19 2002 5:21pm
Subject:Re: 'print' or '\p' from mysql prompt
View as plain text  
At 11:58 -0500 9/19/02, Robert Fox wrote:
>Hello-
>
>I've just started using MySQL so this is absolutely a 'newbie' 
>question. I'm used to working with Oracle's SQL*Plus which is a very 
>different tool. In SQL*Plus, I could type 'l' or 'list' at the 
>SQL*Plus prompt and see a printout to STDOUT (the screen) of the 
>current command in the buffer. Apparently, mysql duplicates this 
>functionality via the 'print' and/or '\p' function. However, even if 
>I have an SQL statement in memory, when I type in this command at 
>the mysql prompt, it simply prints the following:
>
>mysql> print
>--------------
>
>--------------

Yeah, seems like a problem.  Use \p instead.

>
>This seems to indicate that nothing is in the buffer, however if I 
>type 'edit' the command appears from the buffer. Am I doing 
>something wrong? I'm using MySQL v. 3.23.41 on Linux 7.1.
>
>I have another related question. Are we always forced to execute an 
>SQL command immediately after using an editor? In other words, when 
>I type 'edit', edit my command and then exit the editor, I'm 
>released to the '->' prompt which forces me to either clear the 
>buffer or execute the query, neither of which I would like to do 
>immediately.

What would you like to do instead.

>
>Any advice or help with these issues would be appreciated.
>
>Thanks!
>
>Rob
>
>P.S. Another useful command which doesn't seem to be a part of the 
>feature set for the mysql command line utility is a pause option. In 
>Oracle SQL*Plus, I could set a pause feature on by entering the 
>command 'set pause on', and I would be allowed to view a few 
>returned records at a time. Is that option available in the mysql 
>command line tool?

Probably not quite the same thing, but you can use the --pager option
when you invoke mysql to send the output through a paging program like
"more".  Or use the \P and \n commands in mysql to turn paging on/off.
UNIX only, doesn't work on Windows.

Thread
'print' or '\p' from mysql promptRobert Fox19 Sep
  • Re: 'print' or '\p' from mysql promptPaul DuBois19 Sep