Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for sql.Out parameters #232

Open
kogan69 opened this issue Nov 12, 2017 · 4 comments
Open

Support for sql.Out parameters #232

kogan69 opened this issue Nov 12, 2017 · 4 comments

Comments

@kogan69
Copy link

kogan69 commented Nov 12, 2017

Suppose that I'm calling a stored procedure via database.sql and I have a number of output parameters, each of which is a cursor. Is there support for this in this package?
I mean something like this:

func main() {

	db, err := sql.Open("ora", "u/p@host:1521/DB")

	if err != nil {
		panic(err)
	}

	stmt, err := db.Prepare("call sp_get_user_state(:i_user_guid, :o_cur_users,:o_cur_auth_users,:o_cur_acct_accounts,:o_cur_settings)")

	if err != nil {
		panic(err)
	}


	guid := "0028B251D49B9455E050CB0A336D4670"


	r1 := &sql.Rows{}
	r2 := &sql.Rows{}
	r3 := &sql.Rows{}
	r4 := &sql.Rows{}
	res, err := stmt.Exec(guid,
		sql.Named("o_cur_users", sql.Out{Dest:r1}),
		sql.Named("o_cur_auth_users", sql.Out{Dest:r2}),
		sql.Named("o_cur_acct_accounts", sql.Out{Dest:r3}),
		sql.Named("o_cur_settings",sql.Out{Dest:r4} ),
		)

	if err != nil {
		panic(err)
	}

	fmt.Println(res)



}


@tgulacsi
Copy link
Collaborator

sql.Out is not supported yet.
Use &ora.Rset as parameters, and then their methods to retrieve the rows.

@kogan69
Copy link
Author

kogan69 commented Nov 13, 2017 via email

@tgulacsi
Copy link
Collaborator

@kogan69
Copy link
Author

kogan69 commented Nov 13, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants