Skip to content

Instantly share code, notes, and snippets.

@ser1zw
Created June 7, 2012 15:51
Show Gist options
  • Select an option

  • Save ser1zw/2889597 to your computer and use it in GitHub Desktop.

Select an option

Save ser1zw/2889597 to your computer and use it in GitHub Desktop.
カレントバッファの内容をSQL*Plusで実行するxyzzy lisp
;; カレントバッファの内容をSQL*Plusで実行
(defun exec-sqlplus ()
(interactive)
(let ((user "SCOTT")
(passwd "TIGER")
(host "localhost")
(port 1521)
(service-name "XE")
(filename (make-temp-file-name))
command
src)
(setf command (format nil "sqlplus ~A/~A@~A:~A/~A @~A" user passwd host port service-name filename))
(setf src (format nil "~A~%~A~%~A~%" (buffer-substring (point-min) (point-max)) "SHOW ERRORS" "QUIT"))
(with-open-file (out filename :direction :output)
(princ src out))
(execute-shell-command command nil "SQL*Plus Output")
(delete-file filename)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment