Recent Notes
Displaying keyword search results 1 - 5
Created by Dr. Xi on September 06, 2007 03:11:40
Last update: January 31, 2013 12:13:45
The built-in function SYSDATE returns a DATE value containing the current date and time on your system. For example,
UPDATE ACCOUNT SET LAST_MODIFIED = SYSDATE;
updates the LAST_MODIFIED column to the current system time.
select to_char(sysdate, 'MM-DD-YYYY HH24:MI:SS') N...
prints the current date & time.
Created by Dr. Xi on February 06, 2012 12:14:11
Last update: February 07, 2012 15:39:35
Oracle sqlplus command line tools does not support command line editing out-of-the-box. But on Linux there's a handy utility that enables command line editing with any command line tool: rlwrap - readline wrapper.
Install rlwrap:
$ sudo apt-get install rlwrap
Create a keywords file .sql.dict (optional, but convenient):
false null true
access add as asc begin by chec...
It would be nice to add the tables names also.
Create an alias for sqlplus (put it in .bashrc ):
alias sqlplus='rlwrap -f $HOME/.sql.dict sqlplus'
Created by Dr. Xi on March 08, 2011 15:53:33
Last update: March 08, 2011 15:53:33
Use the date_format function to format a date:
mysql> select now() now;
+---------------------...
Created by Dr. Xi on October 09, 2009 19:27:22
Last update: October 09, 2009 19:30:01
PL/SQL code from Pandazen :
CREATE OR REPLACE FUNCTION GET_INSERT_SCRIPT(V_TAB...
Usage:
To create the script for generating the INSERT statements:
set head off
set pages 0
set trims on
set...
Run the resulting script to generate the INSERT script:
set pages 0
set trims on
set lines 2000
...
PL/SQL code from Oracle Ask Tom
set serveroutput on size 100000
set feedbac...
Created by Dr. Xi on March 23, 2009 20:06:08
Last update: March 23, 2009 20:06:08
Oracle provides the function add_months to add or subtract months from a date:
-- add one month
select add_months(sysdate, 1) ...
Oracle does not provide functions like add_days or add_years , but these can be done just as easily:
-- add 12 days
select sysdate + 12 from dual;
...