随笔分类 - SQL
摘要:set linesize 400 pagesize 999\r col machine for a20\r col sql_id for a20\r col prev_sql_id for a20\r col object_name for a20\r col object_type for a20
阅读全文
摘要:19c版本中listagg函数可以不匹配within group进行使用 with temp as( select 'China' nation ,'Guangzhou' city from dual union all select 'China' nation ,'Shanghai' city
阅读全文
摘要:1.脚本如下 snc-sdyd-oceanbase02:~/lhh # cat orac host="172.16.100.136" password=ShSnc123!@# if [ "$1" = "version" ]; then mysql -h"$host" -P2881 -uroot@sy
阅读全文
摘要:set long 1000000 SET PAGESIZE 3000 set lines 200 SET HEADING OFF SET VERIFY OFF SET FEEDBACK OFF set echo on set timing off set wrap On SET LONGCHUNKS
阅读全文
摘要:脚本 vi a.shmysql -uroot -p123456 -N >a.txt<<! select concat(concat('show create table ',TABLE_SCHEMA,'.',TABLE_NAME),'\\\G') from information_schema.ta
阅读全文
摘要:SQL> select 'select dbms_metadata.get_ddl('||chr(39)||object_type||chr(39)||','||chr(39)||object_name||chr(39)||','||chr(39)||owner||chr(39)||') from
阅读全文
摘要:spool dbtime.txt set echo off set termout off set lines 1000 set pages 1000 col con_name for a15 col tablespace_name for a25 SELECT case D.con_id when
阅读全文
摘要:SQL> set serveroutput on SQL> declare 2 cursor c_date is 3 select hire_date from employees; 4 v_date date; 5 v_day varchar2(20); 6 begin 7 open c_date
阅读全文
摘要:在变量赋值的方法中,select into只能为返回单行数据的变量进行赋值 SQL> set serveroutput on SQL> declare 2 v_date date; 3 begin 4 select hire_date into v_date from employees where
阅读全文
摘要:查看要修改的数据 SQL> select * from t1; DATE1 IDENTIFY 22-JAN-21 372928193501213223 通过update修改date1对应的日期 SQL> update t1 set date1=(select to_date(substr(ident
阅读全文