* function name: string gf_getbh (string as_bh)
* the role function: generate a serial number
* the return value: the serial number of type string
* call, for example: ls_new=gf_getbh (ls_old)
* which ls_old window for the data already exists in the
On the day of the largest number
* write date: XXXX. Xx. Xx
* write: XXX
* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - */
String ls_part1//used to store the code before six
String ls_part2//used to store the code after four
String ls_dbsn//database on the same day the biggest serial number
String ls_agrsn//parameters of the serial number
String ls_sn//the serial number of newly generated
Ls_part1=right (string (today (), 'yyyymmdd'), 6)
Ls_agrsn=right (as_bh, 4)
//from the database to select the serial number of the largest
The select Max (bh) into: ls_dbsn
The from MPGL
Where the substring (bh, 1, 6)=: ls_part1;
If the sqlca. Sqlcode=0 then//if the correct took out data
If isnull (ls_dbsn) or ls_dbsn="' then
Ls_dbsn='0000'
The else
Ls_dbsn=right (ls_dbsn, 4)
End the if
If isnull (ls_agrsn) or ls_agrsn="' then
Ls_agrsn='0000'
If an integer (ls_dbsn) & lt; Integer (ls_agrsn) then
Ls_part2=string (integer (ls_agrsn) + 1)
The else
Ls_part2=string (integer (ls_dbsn) + 1)
End the if
Ls_sn=ls_part1 + right (' 0000 '+ ls_part2, 4)
The else
Ls_sn='
End the if
Return ls_sn
Save the tip: error coo93: incompatible type string returned for function
The error coo31: syntax error
The error coo31: syntax error
I am a rookie really don't know where there is wrong
CodePudding user response:
1. The return value data type error,2. Grammar:
If isnull (ls_agrsn) or ls_agrsn="' then
Ls_agrsn='0000'
-- -- -- -- -- - & gt;
If isnull (ls_agrsn) or ls_agrsn="' then ls_agrsn='0000'
CodePudding user response:
Not the wrong error coo93: incompatible type string returned for functionThank you,
But still want to report the error coo31: syntax error
The error coo31: syntax error where such wrong? Grammar wrong?
Seems to be the last few words are wrong but don't really know why wrong
CodePudding user response:
Not show you to, or written in one line, or add a end if