Comments (13)
create utility function and do select
CREATE OR REPLACE PACKAGE dbms_output_table IS
TYPE piped_output IS RECORD (dbms_output VARCHAR2(4000));
TYPE piped_output_table IS TABLE OF piped_output;
FUNCTION display RETURN piped_output_table PIPELINED;
END;
/
CREATE OR REPLACE PACKAGE BODY dbms_output_table IS
FUNCTION display RETURN piped_output_table PIPELINED IS
rec piped_output;
p_status NUMBER;
BEGIN
DBMS_OUTPUT.GET_LINE(rec.dbms_output, p_status);
WHILE p_status = 0 LOOP
PIPE ROW(rec);
DBMS_OUTPUT.GET_LINE(rec.dbms_output, p_status);
END LOOP;
RETURN;
END;
END;
/
rows, err := db.Query("select * from table(dbms_output_table.display);")
from go-oci8.
i can't add something to production database :(
from go-oci8.
go-oci8
is possible to add implementation for fetch output, but database/sql
doesn't provide way to set output-buffer for the query. So currently, it's not possible.
from go-oci8.
okay. thx
from go-oci8.
Does it make sense to support this in go-oci8
out of the database/SQL
interface?
Like the supplied functionality in the competitive oracle driver?
from go-oci8.
It's possible like go-sqlite3's hook. https://github.com/mattn/go-sqlite3/blob/master/_example/hook/hook.go
But currently, go-oci8 doesn't support yet.
from go-oci8.
@mattn Thanks, should follow golang/go#18417 that aggregates some issues that would make the standard interface support SP param bindings.
from go-oci8.
@mattn and @asaf I'm not familiar with this particular aspect of Oracle PL/SQL. Could someone explain this to me? The docs I found: https://docs.oracle.com/cd/B19306_01/appdev.102/b14258/d_output.htm#BABJCAJA
What is this typically used for in production databases? How are ways you might interact with it from your API such as database/sql
?
from go-oci8.
One of the motivation is rowid in oracle. rowid is not number, so go-oci8 doesn't work correctly for the go's LastInsertId. The second, we have to allocate/free the buffer to get result specific value for the pl/sql.
from go-oci8.
Thanks @mattn,
If the goal is to return a non-numerical rowid, then I would need to look at sql.Result.LastInsertId
. Can the driver receive output lines today? Is it just a matter of piping that to the end user somehow? Can multiple lines be outputted and does that happen commonly?
from go-oci8.
Is this now good with adding of SQL out? Can this be closed?
from go-oci8.
@mattn Close this?
from go-oci8.
This should be fixed. Please reopen you still have issue and it is related on go-oci8.
from go-oci8.
Related Issues (20)
- Context cancelation not being honored HOT 6
- error: not found libclntsh.so HOT 2
- [example] set instant client environment by a shell in linux(ubuntu) HOT 1
- OCIEnvCreate error HOT 3
- Can darwin/arm64 golang build this? HOT 1
- is there any fast bulk insert solutions like executemany() in python/node ? HOT 1
- How to connect as sysasm using our driver? HOT 1
- dyld: Library not loaded: @rpath/libclntsh.dylib.12.1
- compiling for linux using mac throws errors HOT 6
- window10 go build Windows to Linux failed,help me plz HOT 7
- Why is the length of lobbuffersize limited to 4000 and can it be increased to 10K or 100k
- Library not loaded: @rpath/libclntshcore.dylib.19.1 HOT 1
- Is there support for Kerberos authentication?
- Is this library maintained? HOT 1
- exit status 0xc0000135, golang with windows HOT 3
- oracle oci8 support mac arm64?,for example mac m1 HOT 4
- How to Execute Stored Procedure?
- Test oracle 19c TAC got error ORA-25412: transaction replay disabled by call to OCITransStart HOT 2
- How to avoid mistakes ORA-29275: 部分多字节字符
- Can the database stop the query statement being executed to cancel the blocking
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-oci8.