发布网友 发布时间:2022-04-26 00:22
共3个回答
懂视网 时间:2022-04-10 04:20
--1 建表
create table city_table
(
city_name varchar2(100)
,District varchar2(100)
);
--2 插入数据
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘北京‘, ‘东城区‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘北京‘, ‘西城区‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘北京‘, ‘崇文区‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘北京‘, ‘宣武区‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘北京‘, ‘朝阳区‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘北京‘, ‘海淀区‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘北京‘, ‘丰台区‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘北京‘, ‘石景山区‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘北京‘, ‘门头沟区‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘北京‘, ‘房山区‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘北京‘, ‘通州区‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘北京‘, ‘顺义区‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘北京‘, ‘昌平区‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘北京‘, ‘大兴区‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘北京‘, ‘怀柔区‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘北京‘, ‘平谷区‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘北京‘, ‘密云县‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘北京‘, ‘延庆县‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘天津‘, ‘河东区‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘天津‘, ‘河西区‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘天津‘, ‘南开区‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘天津‘, ‘河北区‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘天津‘, ‘红桥区‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘天津‘, ‘塘沽区‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘天津‘, ‘汉沽区‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘天津‘, ‘大港区‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘天津‘, ‘东丽区‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘天津‘, ‘西青区‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘天津‘, ‘北辰区‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘天津‘, ‘津南区‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘天津‘, ‘武清区‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘天津‘, ‘宝坻区‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘天津‘, ‘静海县‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘天津‘, ‘宁河县‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘天津‘, ‘蓟县‘);
insert into CITY_TABLE (CITY_NAME, DISTRICT)values (‘天津‘, ‘和平区‘);
commit;
--进击吧
select city_name,wm_concat(District||chr(10))
from city_table
group by city_name;
--结果发现,里面的子信息会按照一行一行的方式进行排列(chr(13),chr(10))
chr(9)的作用是空格
ascii码chr(9),chr(10),chr(13)在oracle中的用法
标签:str oracle 天津 ble 平谷 mit 怀柔区 插入数据 ora
热心网友 时间:2022-04-10 01:28
chr()函数将ASCII码转换为字符:字符 –》 ASCII码;
热心网友 时间:2022-04-10 02:46
select ascii('是') from al;