Home > database >  Two fields, one table to another column data according to the serial number is generated
Two fields, one table to another column data according to the serial number is generated

Time:09-23

Table A: date [FRQ], ticket number [FBillNo]
The 2018-01-01 null
The 2018-01-03 null
The 2018-01-04 null
The 2018-01-21 null

Table A date column, not repeat, I can calculate A number, if say: 013, I want to achieve the following results:

Date [FRQ] documents [FBillNo]
The 2018-01-01 013
The 2018-01-03 014
The 2018-01-04 015
The 2018-01-21 016

CodePudding user response:

According to the date on the attached ROWNUM, (document no. + ROWNUM - 1) as you want to set the value of the
Pay attention to the document character to digital type transformation of the characters

CodePudding user response:

 
The SELECT FRQ, to_char (12 + rn, 'fm099')
The FROM (SELECT FRQ, rownum rn FROM (SELECT FRQ FROM a ORDER BY FRQ));

CodePudding user response:

Recommend a complete Oracle introductory tutorial, here has seen a few introductory tutorial, maybe for your Oracle learning has certain help, "Oracle introductory tutorial", hematemesis recommended, I also is through the introduction to a few articles here,
  • Related