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 PL/SQL and SQL types like Oracle Spatial SDO #147

Closed
bmulcahy opened this issue Jul 22, 2015 · 21 comments
Closed

Support PL/SQL and SQL types like Oracle Spatial SDO #147

bmulcahy opened this issue Jul 22, 2015 · 21 comments

Comments

@bmulcahy
Copy link

I keep getting NJS-010: unsupported data type in select list, when I try to retrieve sdo geometries from a database.

I then tried running a stored function(SDO2GEOJSON) but received the same NJS-010 error but didn't know if that was do to functions not being supported or geometries.

Or this could all be user error on my part.

@cjbj
Copy link
Member

cjbj commented Jul 23, 2015

@bmulcahy there's no support for complex data types. It's on the long list of things to look at but hasn't been prioritized. You could write a wrapper PL/SQL block to decompose the SDO into simple types and call the PL/SQL code.

@cjbj cjbj added the question label Jul 23, 2015
@bmulcahy
Copy link
Author

bmulcahy commented Aug 5, 2015

What data-types are supported?

If i have a stored function on the server to return a string will that work?

Thanks for the help.

@cjbj
Copy link
Member

cjbj commented Aug 5, 2015

@bmulcahy You can use string, date and number OUT binds from PL/SQL blocks. Binding in node-oracledb as string lets a wider range of scalar PL/SQL types be returned.

@cjbj cjbj added enhancement and removed question labels Aug 5, 2015
@cjbj cjbj changed the title Is SDO supported? How about stored functions? Support PL/SQL and SQL types like Oracle Spatial SDO Aug 5, 2015
@cjbj cjbj mentioned this issue Nov 2, 2015
@cjbj cjbj mentioned this issue Sep 5, 2016
@soichih
Copy link

soichih commented Nov 29, 2016

I am seeing "Error: NJS-010: unsupported data type in select list" when I do "SELECT *" from various tables that I am looking at. I am not sure which column / field type that node-oracledb is having trouble accessing.. Is there a way to enable more verbose output - to show which column and which field type is not supported?

@dmcghan
Copy link

dmcghan commented Nov 29, 2016

@soichih I agree that it would be nice if the column name was provided. However, for this type of ad-hoc exploration, I'd recommend using a tool like SQL Developer. It's free and a lot more productive than using the Node.js driver for that type of task.

@dmcghan
Copy link

dmcghan commented Jan 24, 2017

If anyone lands here and needs an example of how to bind record types and/or arrays of record types until there's built-in support for this, here you go: https://jsao.io/2017/01/plsql-record-types-and-the-node-js-driver/

@smtl
Copy link

smtl commented Jan 25, 2017

@dmcghan Thanks for the example. For a function I have

:ret := my_package.my_function( p_the_thing => l_plsql_thing );

In my bind variable, do I still have to have a type attribute?

var bindVars = { input : '111', ret: { dir: oracledb.BIND_OUT, type: oracledb.??? } }

EDIT: In my case the PLSQL is returning a user defined type. I have it working by returning a SYS_REFCURSOR from my PLSQL but wondering if that is the correct way.

@dmcghan
Copy link

dmcghan commented Jan 25, 2017

@smtl Whether a SYS_REFCURSOR is right for you depends on what you're doing. If you want a cursor, then that should be fine. But if you wanted, say, an array of record type variables, then you'd have to do the reverse of what I do in my example.

In other words, rather than assign the result of the function call to a bind variable, you'd assign the result to a locally declared variable in the PL/SQL block. Then you'd have to break the single array up into multiple arrays of type number or varchar2. Those arrays would be the out binds.

When the arrays make it to the JavaScript context, you could reformat them as needed.

Does that make sense?

@smtl
Copy link

smtl commented Jan 25, 2017

Yep, I get what you mean. Thanks.

@teddykh
Copy link

teddykh commented Feb 3, 2017

Is the ability to bind complex types (record types and/or arrays of record types) anywhere in the roadmap?
It's a very important addition especially for users who need to integrate with eBusiness Suite because many "PL/SQL APIs" are exposed as Stored procedures with Table of records type; so instead of interacting directly with the built-in public procedures of EBS, we have to add an extra wrapper for each integration point.
On the other hand, would it be possible to think of a "generic wrapper" (dynamic)? From the first look, it seems to be complex... any thoughts?

@anthony-tuininga
Copy link
Member

The announcement made in the past few days (#601) lays the groundwork for this support. The ODPI-C library has support for this built in. I think I can say that it is somewhere in the roadmap....but I'll let @cjbj comment on where it is found. :-)

@cjbj
Copy link
Member

cjbj commented Feb 3, 2017

There are a lot of different users who prioritize different features. Hearing feedback helps us judge which way to head, so thanks for updating this issue. At this stage we are focused on 1.13 and 2.0 beta (which have effectively the same feature set, see #601). We can then do a review of priorities and decide what we should look at next. There will always be this option too, a point I hope is taken in good spirit since I know not everyone will be able to contribute!

@ahummel25
Copy link

@cjbj Has this been discussed/prioritized any further? Mainly referring to the enhancement in #726.

@cjbj
Copy link
Member

cjbj commented Jul 5, 2017

@ahummel25 it is 'closer' because the ODPI-C layer in node-oracledb v2 has this. ODPI-C replaced the DPI layer which didn't have it.

@ragFOEX
Copy link

ragFOEX commented Aug 23, 2017

Hi all, just stopping by to express my interest in supporting complex datatypes, such as record types (and arrays) in the node-oracldb driver.
Thanks @dmcghan for your blogpost showing the possible workaround. Of course I'd like to have that supported natively :-)

@ahummel25
Copy link

@cjbj Any progress on this regarding being able to bind a PL/SQL table structure to a procedure argument?

@anthony-tuininga
Copy link
Member

Not yet, unfortunately. It is still under consideration, though!

@lkiii
Copy link

lkiii commented Feb 5, 2019

@cjbj Any news on custom type support?

@cjbj
Copy link
Member

cjbj commented Feb 5, 2019

@lkiii Nothing's on paper yet. It's not going to be a small project.

@cjbj
Copy link
Member

cjbj commented Jun 22, 2019

The first, major drop of code to support binding named Oracle types is on the dev-4.0 branch. See #1053 (comment)

@cjbj
Copy link
Member

cjbj commented Jul 25, 2019

Node-oracledb 4.0 has been released with an enhancement for querying and binding of objects. See https://oracle.github.io/node-oracledb/doc/api.html#objects.

A specific Spatial demo is at https://github.com/oracle/node-oracledb/blob/master/examples/selectgeometry.js

The 4.0 release announcement is at https://blogs.oracle.com/opal/oracle-db-named-objects-and-advanced-queuing-support-new-in-node-oracledb-40

@cjbj cjbj closed this as completed Jul 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants