|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
so
I have Firebird 1.5 I want to create a SP to parse a string in order to result some numbers as records CREATE PROCEDURE PARSESTRING( INPUTSTRING VARCHAR(10000)) RETURNS ( ID INTEGER, STR VARCHAR(10), ALLSTRING VARCHAR(10000)) AS DECLARE VARIABLE varStr VARCHAR(10000); DECLARE VARIABLE varIndex integer; declare VARIABLE varTmp varchar(10); BEGIN /* Procedure Text */ varStr = :INPUTSTRING; WHILE (:varStr <> '') DO BEGIN execute procedure StrPos(',', :varStr) RETURNING_VALUES :varIndex; ALLSTRING = varStr; vartmp = SUBSTR(:varStr, 0, :varIndex); vartmp = rtrim(vartmp); vartmp = ltrim(vartmp); str = vartmp; -- ID = CAST(vartmp as INTEGER); varStr = SUBSTR(:varStr, :varIndex + 1, StrLen(:varStr)); SUSPEND; if (varIndex = 0) then break; END END but the SUBSTR dosen't work ... returning only blanks the UDF is standard received with Firebird 1.5 thanks |
|
#2
|
||||
|
||||
|
related to substr size problem (on imput/output parameters) it can use more than 255 chars
Code:
*
* s u b s t r
*
*****************************************
*
* Functional description:
* substr(s,m,n) returns the substring
* of s which starts at position m and
* ending at position n.
* Note: This function is NOT limited to
* receiving and returning only 80 characters,
* rather, it can use as long as 32767
* characters which is the limit on an
* INTERBASE character string.
* Change by Claudio Valderrama: when n>length(s),
* the result will be the original string instead
* of NULL as it was originally designed.
*
*****************************************/
DECLARE EXTERNAL FUNCTION substr
CSTRING(80), SMALLINT, SMALLINT
RETURNS CSTRING(80) FREE_IT
ENTRY_POINT 'IB_UDF_substr' MODULE_NAME 'ib_udf';
Last edited by mariuz : April 23rd, 2004 at 11:04 AM. |
|
#3
|
||||
|
||||
|
tested and doesn't work as expected , but there is a solution
Here is a list thread on the issue
Quote:
|
![]() |
| Viewing: Dev Shed Forums > Databases > Firebird SQL Development > UDF SUBSTR dosen't work properly :( |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|