on the road

0%

字符串连接

Oracle字符串连接使用“||”进行字符串拼接

1
SELECT '工号为'||FNumber||'的员工姓名为'||FName FROM T_Employee WHERE FName IS NOT NULL;

除了“||”,Oracle还支持使用CONCAT()函数进行字符串拼接,比如执行下面的SQL语句:

1
SELECT CONCAT('工号:',FNumber) FROM T_Employee

如果CONCAT中连接的值不是字符串,Oracle会尝试将其转换为字符串

Oracle的CONCAT()函数只支持两个参数,不支持两个以上字符串的拼接,与MYSQL的CONCAT()函数不同

删除当前用户下所有的表

pl/sql连接oracle,执行以下sql。

1
SELECT 'drop  table '|| table_name || ';' FROM USER_TABLES ORDER BY TABLE_NAME;

将查询所得结果,复制粘入command窗口即可。

查看每个表的数据量

1
select t.table_name,t.num_rows from user_tables t ORDER BY NUM_ROWS DESC;

查看表结构

1.命令窗口:desc 表名
2.sql窗口:select * from user_tab_columns where table_name=‘大写表名’;

PL/SQL is a block-structured language whose code is organized into blocks. A PL/SQL block consists of three sections: declaration, executable, and exception-handling sections. In a block, the executable section is mandatory while the declaration and exception-handling sections are optional.

阅读全文 »

Summary: in this tutorial, you will learn about PL/SQL cursor and its usage.

A cursor is a pointer that points to a result of a query. PL/SQL has two types of cursors: implicit cursors and explicit cursors.

阅读全文 »

一、to_char() 与 to_date()函数

  1. to_char()
    将时间日期按照指定的格式输出,得到的是字符串,而非date类型。

    1
    2
    3
    4
    select sysdate,to_char(sysdate, 'yyyy-mm-dd') from dual;
    select sysdate,to_char(sysdate, 'yyyy/mm/dd') from dual;
    select sysdate,to_char(sysdate, 'yyyymmdd') from dual;
    select sysdate,to_char(sysdate, 'yyyymmdd hh24:mi:ss') from dual;

    也可以用to_char()得到单独的年月日时分秒的字符串

    1
    2
    3
    4
    select sysdate,to_char(sysdate,'yyyy') from dual;
    select sysdate,to_char(sysdate,'mm') from dual;
    select sysdate,to_char(sysdate,'hh24') from dual;
    select sysdate,to_char(sysdate,'mi') from dual;
  2. to_date()
    将字符串转换为具体指定的时间日期格式

    1
    2
    3
    4
    select sysdate,to_date('20190103','yyyymmdd') from dual;
    select sysdate,to_date('20190103','yyyy-mm-dd') from dual;
    select sysdate,to_date('20190103','yyyy/mm/dd') from dual;
    select sysdate,to_date('20190103','yyyy-mm-dd hh24:mi:ss') from dual;

二、时间戳转换为时间

1
2
3
SELECT TO_CHAR(时间戳的那一列 / (1000 * 60 * 60 * 24) +
TO_DATE('1970-01-01 08:00:00', 'YYYY-MM-DD HH24:MI:SS'), 'YYYY-MM-DD HH24:MI:SS')
AS createTime FROM tbl_name ;

三、获取当前时间戳

1
select (sysdate - to_date('1970-01-01 08:00:00','yyyy-mm-dd hh24:mi:ss'))*86400000 from dual;

VNC (Virtual Network Computing) is a technology for remote desktop sharing. VNC enables the visual desktop display of one computer to be remotely viewed and controlled over a network connection. It is similar to MSTSC on windows. It uses the Remote Frame Buffer protocol (RFB) to remotely control another computer.

阅读全文 »

spring boot项目中的静态资源文件存放在static文件下面,当通过浏览器访问这些静态文件时,发现必须要添加static作为前缀才能访问,折腾了一番后发现,这个前缀跟 spring.mvc.static-path-pattern 这个配置项有关。

1
spring.mvc.static-path-pattern=/static/**

项目中application.properties配置文件中,存在如上配置项时,访问静态资源文件要加static才行,当把这个配置项除掉时,不用加static作为前缀亦可进行正常访问。

同时配置上下文路径为/,如果存在上下文则需要在链接上添加上下文路径。

1
server.servlet.context-path=/
阅读全文 »

本文主要搜集网上关于NexT主题的配置,包括基础配置以及个性化配置(尚未一一适用,已试用的“√”标识)。

环境:Hexo v4.2.0 NexT.Pisces v7.7.0

定义:站点配置文件hexo/_config.yml,主题配置文件hexo/themes/next/_config.yml

配置文件采用YAML(Yet Another Markup Language)(发音 /ˈjæməl/ )语法

请注意在配置项冒号后面要加一个空格,否则会发生错误!

阅读全文 »