"Error: Too many binds" when executing an INSERT command on SqlBase - guptateamdeveloper

I need help with this error on SqlBase, i've never seen it before.
This are the table columns:
NAME COLNO COLTYPE LENGTH SCALE NULLS UPDATES
==================================== =========== ======== =========== =========== ===== =======
COD_CADENA 1 INTEGER 4 0 N Y
COD_FARMACIA 2 INTEGER 4 0 N Y
NRO_MOVIMIENTO 3 INTEGER 4 0 N Y
DATO1 4 VARCHAR 20 0 Y Y
DATO2 5 VARCHAR 20 0 Y Y
DATO3 6 VARCHAR 20 0 Y Y
DATO4 7 VARCHAR 20 0 Y Y
DATO5 8 VARCHAR 20 0 Y Y
DATO6 9 VARCHAR 20 0 Y Y
DATO7 10 VARCHAR 20 0 Y Y
DATO8 11 VARCHAR 20 0 Y Y
DATO9 12 VARCHAR 40 0 Y Y
DATO10 13 VARCHAR 40 0 Y Y
ESTADO 14 INTEGER 4 0 Y Y
STRING1 15 VARCHAR 200 0 Y Y
DOCUMENTO 16 VARCHAR 30 0 Y Y
NRO_DOCUMENTO 17 VARCHAR 30 0 Y Y
URL 18 VARCHAR 250 0 Y Y
USA_TRACK 19 INTEGER 4 0 Y Y
SYNC_INFO_FLAG 20 INTEGER 4 0 Y Y
Primary keys:
COD_CADENA,
COD_FARMACIA,
NRO_MOVIMIENTO
This is the INSERT command:
INSERT INTO MOV_VALIDADORA (
ESTADO,
USA_TRACK,
DATO1,
DATO10,
DATO2,
DATO3,
DATO4,
DATO5,
DATO6,
DATO7,
DATO8,
DATO9,
DOCUMENTO,
NRO_DOCUMENTO,
STRING1,
URL,
COD_CADENA,
COD_FARMACIA,
NRO_MOVIMIENTO)
values (
null,
0.00000,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
'DNI',
'1212121212',
NULL,
NULL,
1.00000,
716.00000,
5435863.00000);
When executing this command i get this error, what does it mean?, i dont see anything wrong in the command
Error: 00113 SQL TMB Application Programming Error: Too many binds
Thank you!
PS: Why stackoverflow asks me to add more text? my question is already crystal clear.

Try the following:
Remove decimal point and all the zeros behind (maybe it's a problem with number-literal and regional settings)
To narrow the problem first only insert the values for the 3 NOT NULL values. Then step by step add the other column-values.

You don't seem to have any binds. Try removing one column and its corresponding value from the Insert statement one at a time until the Insert works.
Assume you're using SQLTalk here, and not some third party hack that uses a router.

Related

How to select a row from an array based on the highest correlation to a given row?

For each row of a data array X, I want to find the row (number or index) from a data array Y that shows the highest correlation.
X Row
Value 1
Value 2
Value 3
Row index in Y with highest Corr
X1
10
5
1
?
X2
1
5
10
?
Y Row
Value 1
Value 2
Value 3
Y1
1
4
10
Y2
3
4
3
Y3
10
4
1
...
From that, I would want to obtain the row index in Y with the highest correlation to each row in X
X Row
Value 1
Value 2
Value 3
Row index in Y with highest Corr
X1
10
5
1
Y3
X2
1
5
10
Y1
I tried to apply a combination of Index and SortN to Arrayformula(CORREL(X1,Y1:Y)) but that does not work because it seems that correl will concatenate the rows if one argument consists of an array instead of a vector.
Use byrow() and filter(), like this:
=byrow(
B2:D3,
lambda(
rowX,
lambda(
labelY, correlY,
single( filter(labelY, correlY = max(correlY)) )
)(
A11:A13,
byrow(
B11:D13,
lambda(
rowY,
correl(rowX, rowY)
)
)
)
)
)
...where the range A3:D3 holds the X table and the range A11:D13 holds the Y table.

Round negative values to zero in influx query?

I'm trying to set a lower bounds of zero on my influx query result so that negative values are replaced with zero in the result. e.g. For the query:
SELECT x from measurement
If my raw response is
time x
---- -
1632972969471900180 0
1632972969471988621 -130
1632972969472238055 803
then i want to alter the query so that the result is:
time x'
---- -
1632972969471900180 0
1632972969471988621 0
1632972969472238055 803
My solution was to use the ABS absolute value function, adding the absolute value to the original value and dividing by 2. This maps negative values to zero and leaves posiive (and zero) values unchanged. e.g.
SELECT (x + ABS(x)) / 2 from measurement
time x x'
---- - -
1632972969471900180 0 = 0 + 0 / 2 = 0
1632972969471988621 -130 = -130 + 130 / 2 = 0
1632972969472238055 803 = 803 + 803 / 2 = 803

Creating Bitmask for keyboard modifiers + ASCII Code

I would like to encode three keyboard modifiers (CTRL, ALT, SHIFT) + the ASCII code of the pressed key into a single value. This falls naturally into the category of bitmasks.
One way I could do this is that the sender encodes each key as the following:
CTRL: 1000
ALT: 10000
SHIFT: 100000
KeyCode: 1-255
For example, if I were to click all modifiers + the last key in the ascii table, I would get:
100000 + 10000 + 1000 + 255 = 111255. The receiver side it would then be possible to do substraction and check if the number goes below 0 as such:
has_shift = X - 100000 < 0
has_alt = X - 10000 < 0
has_ctrl = X - 1000 < 0
if has_shift
X -= 100000
if has_alt
X -= 10000
if has_ctrl
X -= 1000
keyCode = X (the remainder)
Surely enough, I find this horrible and would assume that this could be done in a far better using bit-shift or something in that ballpark. How could this possibly be done better?
Instead add 256, 512, and 1024 respectively for ctrl, alt, shift. Then use the and operator in whatever language you're using (missing from question tags) to extract the modifiers and code. In C and many languages, that operator is &. So X & 1024 is not zero if shift was pressed. X & 255 is the character code.

Fill missing dates in Google Sheets

I have two columns:
Col A Col B
01.02.2020 17
03.11.2020 24
03.11.2020 12
As I stated in another question, I tried to sum Col B, based on the month in Col A. The solution was the following formula (without the sort):
=ARRAYFORMULA(
SUMIF(
MID(A:A, 4, 2),
SORT(UNIQUE(MID(FILTER(A3:A, A3:A <> ""), 4, 2))),
B:B
)
)
Something I missed was the population of missing months. Therefore my question is: How can I populate the result table with the missing months and zeroes until values are entered? The desired output for the table above would be:e
Col A Col B Col C
01.02.2020 17 0
03.11.2020 24 17
14.12.2020 100 0
03.11.2020 12 0
0
0
0
0
0
0
36
100
If just doing it for the current year, this should be enough
=ArrayFormula(sumif(mid(A2:A,4,2),sequence(12),B2:B))
alternative:
=ARRAYFORMULA(IFNA(VLOOKUP(ROW(A1:A12), QUERY(A:B,
"select month(A),sum(B) group by month(A)"), 2, 0), 0))

IBM DB2 SQLCODE -1424, SQLSTATE 54040 when trying to create a trigger

I have tried to create the following trigger (DB2/LINUXX8664 9.7.2 running over Ubuntu 10.04.2 LTS) but I always get this:
Error report:
DB2 SQL error: SQLCODE: -1424, SQLSTATE: 54040, SQLERRMC: 2
According IBM DB2 documentation:
Too many references to transition variables and transition table columns or the row length for these references is too long. Reason code=rc.
http://www-01.ibm.com/support/knowledgecenter/SSEPGG_9.5.0/com.ibm.db2.luw.messages.sql.doc/doc/msql01424n.html
I really do not understand that explanation. Here the stored procedure and trigger:
CREATE PROCEDURE SP_INSERT_UPDATE_REPNUM (
IN RECNUM INTEGER,
IN CUSTOMER_ID INTEGER,
IN Q_CODE VARCHAR(14),
IN S_CODE VARCHAR(14),
IN REP_STATUS INTEGER,
IN P_CODE INTEGER,
IN REPNUMRG_ID INTEGER,
IN VOLG_LET VARCHAR(1),
IN REP_DATUM DATE,
IN REP_INI VARCHAR(2),
IN INGEBOEKT_DATUM DATE,
IN INGEBOEKT_INI VARCHAR(2),
IN WIJZIGING_DATUM DATE,
IN WIJZIGING_INI VARCHAR(2),
IN OMSCR_STORING VARCHAR(5),
IN OMSCR_WERKZ VARCHAR(5),
IN OMSCR_OPMERKING VARCHAR(5),
IN OMSCR_GEBREK VARCHAR(5),
IN OMSCR_MAT VARCHAR(5),
IN REP_TIJD FLOAT,
IN REP_GEDAAN CHAR(1),
IN ACTION CHAR(1)
)
SPECIFIC SP_INSERT_UPDATE_REPNUM
DYNAMIC RESULT SETS 0
DETERMINISTIC
LANGUAGE JAVA
PARAMETER STYLE JAVA
NO DBINFO
NOT FENCED
THREADSAFE
MODIFIES SQL DATA
PROGRAM TYPE SUB
EXTERNAL NAME 'RepairMigration!insertServiceReport'
and here the trigger:
CREATE TRIGGER INSERT_REPNUM
AFTER INSERT ON REPNUM
REFERENCING NEW ROW AS NROW
FOR EACH ROW MODE DB2SQL
BEGIN
CALL SP_INSERT_UPDATE_REPNUM(
NROW.RECNUM,
NROW.CUSTOMER_ID,
NROW.Q_CODE,
NROW.S_CODE,
NROW.REP_STATUS,
NROW.P_CODE,
NROW.REPNUMRG_ID,
NROW.VOLG_LET,
NROW.REP_DATUM,
NROW.REP_INI,
NROW.INGEBOEKT_DATUM,
NROW.INGEBOEKT_INI,
NROW.WIJZIGING_DATUM,
NROW.WIJZIGING_INI,
NROW.OMSCR_STORING,
NROW.OMSCR_WERKZ,
NROW.OMSCR_OPMERKING,
NROW.OMSCR_GEBREK,
NROW.OMSCR_MAT,
NROW.REP_TIJD,
NROW.REP_GEDAAN,
'I'
);
END
the table structure is thsi one:
RECNUM INTEGER 4 0 N
Q_CODE CHARACTER 14 0 N ''
U_Q_CODE CHARACTER 14 0 N
S_CODE CHARACTER 14 0 N ''
U_S_CODE CHARACTER 14 0 N
VOLG_LET CHARACTER 1 0 N ''
U_VOLG_LET CHARACTER 1 0 N
REP_DATUM DATE 4 0 N '0001-01-01'
REP_INI CHARACTER 2 0 N ''
P_CODE INTEGER 4 0 N 0
CUSTOMER_ID INTEGER 4 0 N 0
REPNUMHD_ID INTEGER 4 0 N 0
REPNUMRG_ID INTEGER 4 0 N 0
REP_STATUS SMALLINT 2 0 N 0
KONTAKT_PER CHARACTER 25 0 N ''
KONTAKT_TEL CHARACTER 20 0 N ''
OMSCR_STORING VARCHAR 512 0 N ''
OMSCR_WERKZ VARCHAR 2000 0 N ''
OMSCR_MAT VARCHAR 512 0 N ''
WIJZIGING_DATUM DATE 4 0 N '0001-01-01'
WIJZIGING_INI CHARACTER 2 0 N ''
INGEBOEKT_DATUM DATE 4 0 N '0001-01-01'
INGEBOEKT_INI CHARACTER 2 0 N ''
REP_GEDAAN CHARACTER 1 0 N ''
U_REP_GEDAAN CHARACTER 1 0 N
STATUS SMALLINT 2 0 N 0
UW_OPDRACHT CHARACTER 20 0 N ''
REP_UREN SMALLINT 2 0 N 0
REP_MINUTEN SMALLINT 2 0 N 0
OMSCR_OPMERKING VARCHAR 1008 0 N ''
OMSCR_GEBREK VARCHAR 512 0 N ''
SERVICE_NUMMER INTEGER 4 0 N 0
PRIJS_OPGAVE CHARACTER 1 0 N ''
CURRENCY SMALLINT 2 0 N 0
REP_TIJD INTEGER 4 0 N 0
After trying to execute the trigger, I get the error. How can I solve this?
UPDATE
It looks that I need to create a temporary tablespace. Listing all my tablespaces, I got some with more than 4k, for example this one:
Tablespace ID = 7
Name = TEMPSPACE1234
Type = Database managed space
Contents = All permanent data. Regular table space.
State = 0x0000
Detailed explanation:
Normal
Total pages = 1024
Useable pages = 1008
Used pages = 432
Free pages = 576
High water mark (pages) = 528
Page size (bytes) = 32768
Extent size (pages) = 16
Prefetch size (pages) = 16
Number of containers = 1
1) Create a 32K Buffer Pool
Example:
CREATE BUFFERPOOL "BUFFERPOOLLARGE" IMMEDIATE
ALL DBPARTITIONNUMS SIZE AUTOMATIC
NUMBLOCKPAGES 0
PAGESIZE 32 K;
2) Create a 32K SYSTEM TEMPORARY TABLESPACE
Example:
CREATE SYSTEM TEMPORARY TABLESPACE "TEMPSPACELARGE"
IN DATABASE PARTITION GROUP "IBMTEMPGROUP"
PAGESIZE 32 K
MANAGED BY AUTOMATIC STORAGE
EXTENTSIZE 32
BUFFERPOOL "BUFFERPOOLLARGE"
OVERHEAD INHERIT
TRANSFERRATE INHERIT
USING STOGROUP "IBMSTOGROUP"
FILE SYSTEM CACHING;
3) Run CREATE PROCEDURE Script Again.
OBS:In the examples I used DB2 automatic TABLESPACE.

Resources