Last active
December 14, 2015 14:19
-
-
Save nolstedt/5100135 to your computer and use it in GitHub Desktop.
Oracle rownum vs Postgres
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table rownum_tst ( | |
id integer, | |
vc varchar(20) | |
); | |
insert into rownum_tst(id,vc) values(1,'4'); | |
insert into rownum_tst(id,vc) values(2,'4,5'); | |
select * from | |
(select rownum as position, vc from rownum_tst) | |
where vc = '4,5'; | |
--postgres gives 1 4,5 | |
--ora gives 2 4,5 | |
--change into to give same result | |
select * from | |
(select row_number() OVER (order by id) as position, vc from rownum_tst) | |
where vc = '4,5'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment