-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Uninitialized variable fix for ISNUMERIC function with varchar and nv…
…archar arguments (#3001) Uninitialized variable fix for ISNUMERIC function with varchar and nvarchar arguments (#2945) * Fix uninitialised variable issue related to varchar2numeric function * Test cases for isnumeric function with varchar and nvarchar variables * removing unintended merged commits Fixing pr comments, added test name to jdbc latest schedule * Added null test case * Added boundary test cases Removed unintended changes in jdbc latest schedule from conflict resolution Task: BABEL-5129 Signed-off-by: manisha-deshpande <[email protected]> Co-authored-by: “manisha-deshpande” <“[email protected]">
- Loading branch information
1 parent
1b0a48a
commit 58dd341
Showing
8 changed files
with
393 additions
and
1 deletion.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
DROP TABLE babel_5129 | ||
GO |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
-- Tests for ISNUMERIC function with varchar and nvarchar variables | ||
CREATE TABLE babel_5129 ( | ||
int_type int, | ||
numeric_type numeric(10,5), | ||
money_type money, | ||
varchar_type varchar(20), | ||
nvarchar_type nvarchar(20) | ||
) | ||
GO | ||
|
||
INSERT INTO babel_5129 ( | ||
int_type, | ||
numeric_type, | ||
money_type, | ||
varchar_type, | ||
nvarchar_type | ||
) | ||
VALUES ( | ||
45000, | ||
12345.12, | ||
237891.22, | ||
'12.3420000000', | ||
'12.3420000000' | ||
) | ||
GO | ||
~~ROW COUNT: 1~~ | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,217 @@ | ||
|
||
-- Tests for ISNUMERIC function with varchar and nvarchar variables | ||
SELECT * FROM babel_5129 | ||
GO | ||
~~START~~ | ||
int#!#numeric#!#money#!#varchar#!#nvarchar | ||
45000#!#12345.12000#!#237891.2200#!#12.3420000000#!#12.3420000000 | ||
~~END~~ | ||
|
||
-- Test int | ||
SELECT ISNUMERIC(int_type) | ||
FROM babel_5129 | ||
GO | ||
~~START~~ | ||
int | ||
1 | ||
~~END~~ | ||
|
||
-- Test numeric | ||
SELECT ISNUMERIC(numeric_type) | ||
FROM babel_5129 | ||
GO | ||
~~START~~ | ||
int | ||
1 | ||
~~END~~ | ||
|
||
-- Test money | ||
SELECT ISNUMERIC(money_type) | ||
FROM babel_5129 | ||
GO | ||
~~START~~ | ||
int | ||
1 | ||
~~END~~ | ||
|
||
-- Test varchar | ||
SELECT ISNUMERIC(varchar_type) | ||
FROM babel_5129 | ||
GO | ||
~~START~~ | ||
int | ||
1 | ||
~~END~~ | ||
|
||
-- Test nvarchar | ||
SELECT ISNUMERIC(nvarchar_type) | ||
FROM babel_5129 | ||
GO | ||
~~START~~ | ||
int | ||
1 | ||
~~END~~ | ||
|
||
|
||
-- Test numeric variable | ||
DECLARE @a numeric(24,6); | ||
SELECT @a = 12.3420000000; | ||
SELECT ISNUMERIC(@a), LEN(@a), DATALENGTH(@a) | ||
GO | ||
~~START~~ | ||
int#!#int#!#int | ||
1#!#9#!#6 | ||
~~END~~ | ||
|
||
|
||
-- Test varchar variable | ||
DECLARE @v varchar(20); | ||
SELECT @v = '12.3420000000'; | ||
SELECT ISNUMERIC(@v), LEN(@v), DATALENGTH(@v) | ||
GO | ||
~~START~~ | ||
int#!#int#!#int | ||
1#!#13#!#13 | ||
~~END~~ | ||
|
||
|
||
-- Test nvarchar variable | ||
DECLARE @nv nvarchar(10); | ||
SELECT @nv = '12.3420000000'; | ||
SELECT ISNUMERIC(@nv), LEN(@nv), DATALENGTH(@nv) | ||
GO | ||
~~START~~ | ||
int#!#int#!#int | ||
1#!#10#!#10 | ||
~~END~~ | ||
|
||
|
||
-- Test NULL varchar variable | ||
DECLARE @v varchar(20); | ||
SELECT @v = NULL; | ||
SELECT ISNUMERIC(@v), LEN(@v), DATALENGTH(@v) | ||
GO | ||
~~START~~ | ||
int#!#int#!#int | ||
0#!#<NULL>#!#<NULL> | ||
~~END~~ | ||
|
||
|
||
-- Test NULL nvarchar variable | ||
DECLARE @nv nvarchar(10); | ||
SELECT @nv = null; | ||
SELECT ISNUMERIC(@nv), LEN(@nv), DATALENGTH(@nv) | ||
GO | ||
~~START~~ | ||
int#!#int#!#int | ||
0#!#<NULL>#!#<NULL> | ||
~~END~~ | ||
|
||
|
||
-- Test empty varchar variable | ||
DECLARE @v varchar(20); | ||
SELECT @v = ''; | ||
SELECT ISNUMERIC(@v), LEN(@v), DATALENGTH(@v) | ||
GO | ||
~~START~~ | ||
int#!#int#!#int | ||
0#!#0#!#0 | ||
~~END~~ | ||
|
||
|
||
-- Test empty nvarchar variable | ||
DECLARE @nv nvarchar(10); | ||
SELECT @nv = ''; | ||
SELECT ISNUMERIC(@nv), LEN(@nv), DATALENGTH(@nv) | ||
GO | ||
~~START~~ | ||
int#!#int#!#int | ||
0#!#0#!#0 | ||
~~END~~ | ||
|
||
|
||
-- Test varchar with number argument that exceeds range of bigint. | ||
DECLARE @v varchar(20); | ||
SELECT @v = '9223372036854775807'; | ||
SELECT ISNUMERIC(@v), LEN(@v), DATALENGTH(@v) | ||
GO | ||
~~START~~ | ||
int#!#int#!#int | ||
1#!#19#!#19 | ||
~~END~~ | ||
|
||
|
||
DECLARE @v varchar(20); | ||
SELECT @v = '-9223372036854775808'; | ||
SELECT ISNUMERIC(@v), LEN(@v), DATALENGTH(@v) | ||
GO | ||
~~START~~ | ||
int#!#int#!#int | ||
1#!#20#!#20 | ||
~~END~~ | ||
|
||
|
||
-- Test nvarchar with number argument that exceeds range of bigint. | ||
DECLARE @nv nvarchar(20); | ||
SELECT @nv = '9223372036854775807'; | ||
SELECT ISNUMERIC(@nv), LEN(@nv), DATALENGTH(@nv) | ||
GO | ||
~~START~~ | ||
int#!#int#!#int | ||
1#!#19#!#19 | ||
~~END~~ | ||
|
||
|
||
DECLARE @nv nvarchar(20); | ||
SELECT @nv = '-9223372036854775808'; | ||
SELECT ISNUMERIC(@nv), LEN(@nv), DATALENGTH(@nv) | ||
GO | ||
~~START~~ | ||
int#!#int#!#int | ||
1#!#20#!#20 | ||
~~END~~ | ||
|
||
|
||
-- Test varchar with lengthy numeric value | ||
DECLARE @v varchar; | ||
SELECT @v = '12345678901234567890123456789012345'; | ||
SELECT ISNUMERIC(@v), LEN(@v), DATALENGTH(@v) | ||
GO | ||
~~START~~ | ||
int#!#int#!#int | ||
1#!#1#!#1 | ||
~~END~~ | ||
|
||
|
||
-- Test nvarchar with lengthy numeric value | ||
DECLARE @nv nvarchar; | ||
SELECT @nv = '12345678901234567890123456789012345'; | ||
SELECT ISNUMERIC(@nv), LEN(@nv), DATALENGTH(@nv) | ||
GO | ||
~~START~~ | ||
int#!#int#!#int | ||
1#!#1#!#1 | ||
~~END~~ | ||
|
||
|
||
-- Test varchar variable with invalid numeric | ||
DECLARE @v varchar(20); | ||
SELECT @v = '12.34.20000000'; | ||
SELECT ISNUMERIC(@v), LEN(@v), DATALENGTH(@v) | ||
GO | ||
~~START~~ | ||
int#!#int#!#int | ||
0#!#14#!#14 | ||
~~END~~ | ||
|
||
|
||
-- Test nvarchar variable with invalid numeric | ||
DECLARE @nv nvarchar(10); | ||
SELECT @nv = '12.34.20000000'; | ||
SELECT ISNUMERIC(@nv), LEN(@nv), DATALENGTH(@nv) | ||
GO | ||
~~START~~ | ||
int#!#int#!#int | ||
0#!#10#!#10 | ||
~~END~~ | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
DROP TABLE babel_5129 | ||
GO |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
-- Tests for ISNUMERIC function with varchar and nvarchar variables | ||
|
||
CREATE TABLE babel_5129 ( | ||
int_type int, | ||
numeric_type numeric(10,5), | ||
money_type money, | ||
varchar_type varchar(20), | ||
nvarchar_type nvarchar(20) | ||
) | ||
GO | ||
|
||
INSERT INTO babel_5129 ( | ||
int_type, | ||
numeric_type, | ||
money_type, | ||
varchar_type, | ||
nvarchar_type | ||
) | ||
VALUES ( | ||
45000, | ||
12345.12, | ||
237891.22, | ||
'12.3420000000', | ||
'12.3420000000' | ||
) | ||
GO |
Oops, something went wrong.