如果我只需要排序,如何从表中获取previous
或product_id?例如,如果我有和,我想获得下一条记录并且我有和,我想获得上一条记录 我怎样才能做到这一点?next
varchar
PRODUCT_NO='20120033'
PRODUCT_REGISTRATION_NO='yellow'
PRODUCT_ID which is 4
PRODUCT_NO='20120033'
PRODUCT_REGISTRATION_NO='green'
PRODUCT_ID which is 3
谢谢
表结构和数据贴在下面
CREATE TABLE MYTAB
(
PRODUCT_ID NUMBER,
PRODUCT_NO VARCHAR2(),
PRODUCT_REGISTRATION_NO VARCHAR2(32)
);
SET DEFINE OFF;
Insert into MYTAB
(PRODUCT_ID, PRODUCT_NO, PRODUCT_REGISTRATION_NO)
Values
(3, '20120033', 'yellow');
Insert into MYTAB
(PRODUCT_ID, PRODUCT_NO, PRODUCT_REGISTRATION_NO)
Values
(4, '20120033', 'green');
Insert into MYTAB
(PRODUCT_ID, PRODUCT_NO, PRODUCT_REGISTRATION_NO)
Values
(5, '20120034', 'wine');
Insert into MYTAB
(PRODUCT_ID, PRODUCT_NO, PRODUCT_REGISTRATION_NO)
Values
(6, '20120034', 'soda');
COMMIT;