Skip to Main Content

NoSQL Database

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

PREPARE Statement Fails with "Invalid UUID String" Error

1745752Nov 11 2024 — edited Nov 11 2024

I'm using Oracle NoSQL Database CE Version 24.3.9

When executing the prepare statement with UUID field and DECLARE variable, the database returns [IllegalArgument]: PREPARE: Illegal Argument: Invalid UUID string :

This issue does not appear in the cloud version.

Any guidance or suggestions would be greatly appreciated!

DDL:

CREATE TABLE IF NOT EXISTS a (
   a_id STRING AS UUID,
   b_id STRING AS UUID,
   state STRING,
   PRIMARY KEY(a_id)
)

Prepare Statement:

DECLARE $a string;$state string;$b string; UPDATE a SET state = $state WHERE a_id = $a AND b_id = $b AND state = 'listing'

Code to Reproduce:

package main
import (
    "fmt"
    "github.com/oracle/nosql-go-sdk/nosqldb"
    "time"
)
func main() {
    cfg := nosqldb.Config{
        Mode:     "onprem",
        Endpoint: "http://127.0.0.1:8080",
    }
    client, err := nosqldb.NewClient(cfg)
    if err != nil {
        fmt.Printf("failed to create a NoSQL client: %v\n", err)
        return
    }
    defer client.Close()
    err = tableOp(client, `
CREATE TABLE IF NOT EXISTS a (
   a_id STRING AS UUID,
   b_id STRING AS UUID,
   state STRING,
   PRIMARY KEY(a_id)
)`, nosqldb.OnDemandTableLimits(1))
    if err != nil {
        panic(err)
    }
    result, err := client.Prepare(&nosqldb.PrepareRequest{
        Statement: "DECLARE $a string;$state string;$b string; UPDATE a SET state = $state WHERE a_id = $a AND b_id = $b AND state = 'listing'",
    })
    if err != nil {
        panic(err)
    }
    fmt.Println(result)
}
func tableOp(client *nosqldb.Client, statement string, tableLimit *nosqldb.TableLimits) error {
    tableRes, err := client.DoTableRequest(&nosqldb.TableRequest{
        Statement:   statement,
        TableLimits: tableLimit,
    })
    if err != nil {
        return fmt.Errorf("tableOp failed: %v\n", err)
    }
    _, err = tableRes.WaitForCompletion(client, 60*time.Second, time.Second)
    if err != nil {
        return fmt.Errorf("Error tableOp request: %v\n", err)
    }
    return nil
}
Comments
Post Details
Added on Nov 11 2024
0 comments
281 views