Getting error "sqlite3_step failure: datatype mismatch"

35 Views Asked by At

Query:

"SELECT * FROM INVENTORY_ORG_LIST WHERE InventoryOrgName LIKE ? OR InventoryOrgCode LIKE ? LIMIT 50 OFFSET ?";
params = [`${this.searchText}%`, `${this.searchText}%`, (this.page - 1) * BUSINESS_CONFIG.queryLimitSize];

params is giving correct response (["HOI%","HOI%",50];). Data in table:

"[
    [
        "InventoryOrgId$PK",
        "BusinessUnitId",
        "BusinessUnitName",
        "InventoryOrgCode",
        "SiteType",
        "InventoryOrgName",
        "MasterOrganizationId",
        "IsWMSEnabled",
        "DefaultDestSubInventory",
        "LastUpdateDate"
    ],
    [
        "7984",
        "7923",
        "TEXAS_OU",
        "WAC",
        null,
        "Waco_Inventory",
        "7926",
        "NO",
        "Truck 001",
        "22-FEB-21"
    ],
    [
        "7963",
        "7923",
        "TEXAS_OU",
        "HUI",
        null,
        "Houston Warehouse",
        "7926",
        "Yes",
        "010",
        "11-NOV-20"
    ],
    [
        "8004",
        "7923",
        "TEXAS_OU",
        "WFI",
        null,
        "West Fraser Inventory",
        "7926",
        "NO",
        "Store1",
        "10-AUG-21"
    ],
    [
        "8064",
        "7923",
        "TEXAS_OU",
        "FSO",
        null,
        "Frisco Inventory",
        "7926",
        "NO",
        null,
        "01-JUN-22"
    ],
    [
        "7925",
        "7923",
        "TEXAS_OU",
        "DLI",
        null,
        "Dallas_Warehouse",
        "7926",
        "Yes",
        "010",
        "06-FEB-21"
    ],
    [
        "7927",
        "7923",
        "TEXAS_OU",
        "AUI",
        null,
        "Austin_Warehouse",
        "7926",
        "Yes",
        null,
        "06-FEB-21"
    ],
    [
        "8044",
        "7923",
        "TEXAS_OU",
        "MID",
        null,
        "Midland_Inventory",
        "7926",
        "NO",
        null,
        "21-MAY-22"
    ],
    [
        "7964",
        "7923",
        "TEXAS_OU",
        "HOI",
        null,
        "Houston_Inventory",
        "7926",
        "NO",
        "Store1",
        "06-FEB-21"
    ]
]"

I get this error:

{code: 0, message: "sqlite3_step failure: datatype mismatch"}

But when I use SELECT * FROM INVENTORY_ORG_LIST it works and gives expected data.

0

There are 0 best solutions below