In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
PostgreSQL has a function to generate sequences, which makes it easy to create data. Here I use ORACLE to implement the generate_series function of PGSQL.
POSTGRESQL.
T_girl=# select * from generate_series (1cm10) Generate_series- 1 2 3 4 5 6 7 8 9 10 (10 lines) time: 1.290 mst_girl=# select * from generate_series Generate_series- 1 3 5 7 9 (5 lines) time: 0.431 mst_girl=# select * from generate_series Generate_series- 1 4 7 10 (4 lines) time: 0.879 mst_girl=# select * from generate_series Generate_series- 2 58 (3 lines record) time: 0.867 mst_girl=# select count (*) from generate_series (1 mine1000) Count- 1000 (1 line record) time: 1.142 mst_girl=# select to_char (now () -'1 day'::interval * n as result from generate_series (1m 10) g (n) Result- 2015-12-08 2015-12-07 2015-12-06 2015-12-05 2015-12-04 2015-12-03 2015-12-02 2015-12-01 2015-11-30 2015-11-29 (10 lines) time: 17.284 ms
ORACLE:
12:10:34 SQL > select * from table (ytt_generate_series (1penny 10)) COLUMN_VALUE-1 2 3 4 5 6 7 8 9 10 10 10 rows have been selected. Elapsed time: 00: 00: 00.0212 SQL 10 SQL > select * time (ytt_generate_series (1mem10 Magi 2)) COLUMN_VALUE-1 3 5 7 9 elapsed time: 00: 00: 00.0012 SQL 10 SQL > select * time (ytt_generate_series (1mem10 Magazine 3)) COLUMN_VALUE-1 4 7 10 Elapsed time: 00: 00: 00.0012 SQL 10 SQL > select * from table (ytt_generate_series (2Jing 10 Magi 3)) COLUMN_VALUE-2 5 8 elapsed time: 00: 00: 00.0212 SQL 11 SQL > select count (*) from table (ytt_generate_series (1pm 1000)) COUNT (*)-1000 Elapsed time: 00: 00: 00.1313 SQL 32 SQL > select to_char (sysdate-n 'YYYY-MM-DD') from table (ytt_generate_series (1m 10)) TO_CHAR (SY-2015-12-082015-12-072015-12-062015-12-052015-12-042015-12-032015-12-022015-12-012015-11-302015-11-29 10 rows have been selected. Time spent: 00: 00: 00.01
Attach the code:
-- Declare result set.create or replace type ytt_num is object (n number); / create or replace type numbers_table is table of ytt_num;/-- Function body.-- Created by ytt.-- 2015/12/9create or replace function ytt_generate_series (f_start_num number: = 1,-- Start number.f_end_num number,-- Finish number.f_step_num number: = 1-- Step.) return numbers_table pipelinedis list numbers_table: = numbers_table (); I number: = 0 J number: = 1 Increase nested table's size begin I: = frankstartnumb; j: = 1;-- List.extend (f_end_num);-- Loop begin. While i
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.