Giter VIP home page Giter VIP logo

Comments (1)

sijms avatar sijms commented on August 27, 2024

this code is working without errors
v2.7.10
go v1.18+
database 19c

package main

import (
	"database/sql"
	"fmt"
	_ "github.com/sijms/go-ora/v2"
	"os"
)

func Query(db *sql.DB) {
	rows, err := db.Query(`select t1.sql_Id,t1.sql_text,t2.elapsed_time_total as elapsed_time, t2.executions_total as executions 
from dba_hist_sqltext t1 inner join dba_hist_sqlstat t2 on t1.sql_id=t2.sql_id where t1.command_type=3`)
	if err != nil {
		panic(err)
	}
	var id, sql string
	var et, ex int
	for rows.Next() {
		err := rows.Scan(&id, &sql, &et, &ex)
		if err != nil {
			panic(err)
		}
	}
	if rows.Err() != nil {
		panic(rows.Err())
	}
}
func main() {
	conn, err := sql.Open("oracle", os.Getenv("DSN"))
	if err != nil {
		fmt.Println(err)
		return
	}
	defer conn.Close()
	Query(conn)
}

from go-ora.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.