Skip to content

How to execute SQL with paramter marker in Recommend index mode  #15

@joydba

Description

@joydba
sql = "SELECT id, breed, name, weight FROM animals WHERE id < ? AND weight > ?"

conn = ibm_db.connect(config.database, config.user, config.password)

if conn:
    stmt = ibm_db.prepare(conn, sql)

    if ibm_db.execute(stmt):  --- **throw's errors while executing it** 
        row = ibm_db.fetch_tuple(stmt)
        while ( row ):
            #row.each { |child| print child }
            for i in row:
                print(i)
            row = ibm_db.fetch_tuple(stmt)
    ibm_db.close(conn)
else:
    print("Connection failed.")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions