Insert SDO_GEOMETRY using array binding
Hi,
does anyone know howto insert the elem_info array and the ordinates array of a SDO_GEOMETRY object using array binding and ODP or if there is a way to insert the SDO_GEOMETRY object using the same technique.
/Anders
The current releases of ODP.NET do not support object types, hence no "proper" SDO_GEOMETRY support. You can retrieve the data as an XML-type as illustrated here:
Re: ODP.Net + Spatial
I know of no way to insert an SDO_GEOMETRY object using array binding at this time.
If someone else has a solution, please do post!
- Mark
Similar Messages
-
Using array binding to perform multiple rowupdates in one pass
For the first time I am attempting to use array binding in VB.NET to update multiple rows via a single execution of a stored procedure. My subroutine is:
Friend Sub UpdateSolutionStatusUsingArrays(ByVal intNumBeingUpdated As Integer, ByVal arrScenarioID() As Integer, ByVal arrSolutionID() As Integer, ByVal arrInOrOut() As Integer, ByVal arrTimePeriod() As Integer)
Try
'Set up the Command object
Dim cmdUpdateSolutionStatus As OracleCommand
cmdUpdateSolutionStatus = New OracleCommand
cmdUpdateSolutionStatus.CommandType = CommandType.StoredProcedure
cmdUpdateSolutionStatus.CommandText = "ProcUpdateSolutionStatus"
cmdUpdateSolutionStatus.Connection = cnnORACLE
cmdUpdateSolutionStatus.ArrayBindCount = intNumBeingUpdated - 1
cmdUpdateSolutionStatus.CommandTimeout = CInt(tblOptions.Rows(intDatabaseIndex).Item("ConnectionTimeout"))
'Add ScenarioID array as parameter
Dim p_ScenarioID As New OracleParameter("ScenarioID", OracleDbType.Int32)
p_ScenarioID.Direction = ParameterDirection.Input
p_ScenarioID.Value = arrScenarioID
cmdUpdateSolutionStatus.Parameters.Add(p_ScenarioID)
'Add SolutionID array as parameter
Dim p_SolutionID As New OracleParameter("SolutionID", OracleDbType.Int32)
p_SolutionID.Direction = ParameterDirection.Input
p_SolutionID.Value = arrSolutionID
cmdUpdateSolutionStatus.Parameters.Add(p_SolutionID)
'Add InOrOut array as parameter
Dim p_InOrOut As New OracleParameter("InOrOut", OracleDbType.Int32)
p_InOrOut.Direction = ParameterDirection.Input
p_InOrOut.Value = arrInOrOut
cmdUpdateSolutionStatus.Parameters.Add(p_InOrOut)
'Add TimePeriod array as parameter
Dim p_TimePeriod As New OracleParameter("TimePeriod", OracleDbType.Int32)
p_TimePeriod.Direction = ParameterDirection.Input
p_TimePeriod.Value = arrTimePeriod
cmdUpdateSolutionStatus.Parameters.Add(p_TimePeriod)
'Open connection
cnnORACLE.Open()
'Run stored procedure
cmdUpdateSolutionStatus.ExecuteNonQuery()
'Tidy up
cmdUpdateSolutionStatus = Nothing
cnnORACLE.Close()
Catch ex As Exception
WriteLog("Subroutine UpdateSolutionStatusUsingArrays:" & ex.Message.ToString)
strState = "Error"
'Update Run Status to show error has occurred
cnnORACLE.Close()
UpdateRunStatusORACLE(7)
End Try
End Sub
When the routine tries to run cmdUpdateSolutionStatus.ExecuteNonQuery() I get the error message:
Unable to cast object of type 'System.Int32[]' to type 'System.IConvertible'.
I have tried all sorts of variants of the code but with no success. The arrays are being set up correctly. Anyoneone know what I'm missing?
StewartTry declaring the arrays as OracleNumber datatype instead of Integer. I've had this issue before, and I believe this is what I did to solve the problem.
-
Can I use Array Binding with a ExecuteDataSet or ExecuteReader methods?
I want to use Array binding with selects. From the examples that I see so far it seems like everyone is showing the ExecuteNonQuery method. I wonder if I can use this functionality with a regular query that returns ref cursoros.
Andrzejwhat is the error you recieve?
-
Exception Handling for Array Binding
Hi
1)
I am using a Stored Procedure.
I am using array binding and if i am sending an array of count 10 to be inserted in a table and only 9 got inserted,i deliberatly inserted one errorneous record in array, the count returned by ExecuteNonQuery() is 10.Why ?
How can i come to know exact number of rows inserted in table, how can i use Output variables, because the array bind count is 10 so if i add an output parameter it gives error ArrayBind count is wrong....
2)
Is it possible to roll back all the inserts if error occurs in any of the insert by Oracle engine.What it does is it inserts all correct records and leaves the errorneous record and doesn't even throw any exception or any message.
Answer - This can be achieved by using OracleTransaction and don't use Exception handling in procedure otherwise there wont be any exception thrown by procedure which is necessary to detect if an error occured during insert.If you use exception handling OracleEngine will insert correct rows and leave errorneous record and return count of inserted + non inserted records which is wrong.
Please help.
Message was edited by:
user556446
Message was edited by:
user556446You'll need to encapsulate your validation within it's own block as described below:
-- this will die on the first exception
declare
TYPE T_BADDATA_TEST IS TABLE OF VARCHAR2(1000) INDEX BY binary_integer ;
tbt T_BADDATA_TEST ;
aBadTypeFound exception ;
begin
tbt(0) := 'a';
tbt(1) := 'b';
tbt(2) := 'c';
for idx in tbt.first..tbt.last loop
if tbt(idx) = 'b' then
raise aBadTypeFound ;
else
dbms_output.put_line(tbt(idx));
end if ;
end loop ;
end ;--encapsulate the exception area in a begin/end block to handle the exception but continue on
declare
TYPE T_BADDATA_TEST IS TABLE OF VARCHAR2(1000) INDEX BY binary_integer ;
tbt T_BADDATA_TEST ;
aBadTypeFound exception ;
begin
tbt(0) := 'a';
tbt(1) := 'b';
tbt(2) := 'c';
for idx in tbt.first..tbt.last loop
BEGIN
if tbt(idx) = 'b' then
raise aBadTypeFound ;
else
dbms_output.put_line(tbt(idx));
end if ;
EXCEPTION
WHEN aBadTypeFound THEN
dbms_output.put_line(tbt(idx) || ' is bad data');
WHEN OTHERS THEN
dbms_output.put_line('exception');
END ;
end loop ;
end ;
output:
a
b is bad data
c
***/ -
Array Bind: nbr of updated rows?
Hello,
when using array binding with UPDATE statements, how to look up the number of updated rows?
I couldn't find any parameter property such as ArrayBindAffectedRows.
Is it possible to use array bind with SQL statements which return values, e.g.:
UPDATE emp SET salary = salary + :increase
WHERE mgr = :mgrNo
RETURNING salary INTO :newSalary;
Hm, arrays :increase and :newSalary might have different lengths.
Thanks,
ArminOk this is genuinly tricky.
The only way I can think of to get this is to use FORALL and BULK COLLECT. This does an array-bound insert from PL/SQL. But you need to pass Associative Arrays from ODP.NET to PL/SQL to get this started.
Any other solution I could think of would require running some PL/SQL code for each update statement, for instance in a trigger. But avoiding the context switches from PL/SQL to SQL is a main reason to use array binding in the first place.
Here's a complete sample program:
I used inline PL/SQL for compactness, but you might want to save the block as a procedure.
using System;
using System.Data;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
public class Test
static OracleConnection connect()
string constr = "data source=oracle;user id=scott;password=tiger";
OracleConnection con = new OracleConnection(constr);
con.Open();
return con;
const string sql = @"
declare
type NumTable is table of Number index by binary_integer;
l_managers NumTable := :mgr;
l_increase NumTable := :inc;
l_newSals NumTable;
l_records int;
begin
forall idx in l_managers.first .. l_managers.last
update emp
SET
sal = sal + l_increase(idx)
WHERE mgr = l_managers(idx)
RETURNING sal BULK COLLECT INTO l_newSals;
:records_affected := l_newSals.count;
end;
[STAThread]
static void Main(string[] args)
try
using (OracleConnection con = connect())
string cr = new String(new char[] {(char)13});
OracleCommand cmd = new OracleCommand(sql.Replace(cr,""),con);
OracleDecimal[] increases = new OracleDecimal[] {10,20,30};
int[] managers = new int[] { 7698,7839,7782};
OracleParameter pMgr = cmd.Parameters.Add("manager",
OracleDbType.Int32,
ParameterDirection.Input);
pMgr.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
pMgr.Size = managers.Length;
pMgr.Value = managers;
OracleParameter pInc = cmd.Parameters.Add("increase",
OracleDbType.Decimal,
ParameterDirection.Input);
pInc.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
pInc.Size = increases.Length;
pInc.Value = increases;
OracleParameter pRecs = cmd.Parameters.Add("records",
OracleDbType.Int32 ,
ParameterDirection.Output);
pRecs.CollectionType = OracleCollectionType.None;
cmd.ExecuteNonQuery();
int recs = (int)pRecs.Value;
Console.WriteLine("{0} records affected",recs );
catch (Exception ex)
Console.WriteLine(ex);
} -
Support for Array Binding and PL/SQL tables (IN, INOUT, or OUT)
I have attempted, unsuccessfully, to use array binding in stored procedure/function calls where the sp/sf has parameters that are PL/SQL tables. I have seen the topic floating around in this forum, but I have not seen the explicit questions:
- Does ODP.NET support PL/SQL tables as IN, INOUT or OUT parameters to stored procedures/functions?
- Will any planned ODP.NET release support PL/SQL tables as IN, INOUT or OUT parameters to stored procedures/functions?
I am aware that I can use REF CURSORS to handle the OUT situation, but I need to make a design decision concerning supporting parameters of IN and INOUT PL/SQL tables.
Thanks.
JamesYou really MUST do this!! - i.e. include support for PL/SQL table parameters (IN INOUT and OUT) in a future release of ODP.NET.
PL/SQL tables are a fundamental type in Oracle stored procedures and you will be preventing a huge number of existing projects from migrating to .NET if you don't acknowledge them as part and parcel of Oracle programming.
I sincerely hope support for PL/SQL table parameters is treated as a serious issue.
Think what a coup it would be for you over Microsoft (who don't currently support PL/SQL tables with their .NET native provider for Oracle and don't look as if they will at least in the short term)!
Please, please, please! -
Problems with Array-Parameters when using Document-Binding
Hi,
I use the following environment:
JDeveloper 11.1.1.3.0
WLS 10.3.3.0
I created a small EJB (2.1), containing a simple method, which is using arrays as parameters:
public String doTestArray(String[] aStringArray, int[] aIntArray)
throws RemoteException;
I exposed this EJB as a Webservice using JDev's Webservice wizard. I choosed Document/Wrapped-Binding. WSDL and mapping file are being generated. Made an EAR-Deployment-Profile and deployed the application to Integrated-WLS.
I tried to test the Webservice with the WLS integrated test client, which is generating the following request:
<doTestArrayElement xmlns="http://model/types/">
<!--Zero or more repetitions:-->
<arrayOfString_1>string</arrayOfString_1>
<!--Zero or more repetitions:-->
<arrayOfint_2>3</arrayOfint_2>
</doTestArrayElement>
Unfortunately, the invokation fails. WLS returns
weblogic.wsee.codec.CodecException: Failed to decode message
at weblogic.wsee.codec.soap11.SoapCodec.decode(SoapCodec.java:188)
at weblogic.wsee.ws.dispatch.server.CodecHandler.decode(CodecHandler.java:139)
That only happens in methods, which use array-parameters. Simple parameters are no problem.
However, when I use RPC/Encoded as Webservice-Binding, everything seems to be fine.
Does WLS have problems in general using array-parameters and Document-Binding?
Any help would be appreciated.
Thanks,
StefanHi Josko,
Where do you have this problem 3.5 or 7.0 BexAnalyzer.
When ever heirarchy icons are created in BEx, respective hyperlink is assigned to each of them, Make sure that you dont manipulate with them,,
If you still have problem then create OSS message.
Regards,
Vinay -
can you give me a example vi for it ?thanks a lot!
how to auto insert a number array with size of 20 into a named excel file with the positon is from A1 TO A20?i use lv6.1You don't need us to give you an example, as the example already comes with LV. Go to Help>>Find Examples and search for "excel". You will find an example called "write table to XL". You should note that the example doesn't do that exactly, because it writes a 2D array from 2 to N.
You can modify the example by using only one for loop (instead of nested loops) with a 1D array or by going into the Set Cell Value and modifying it to accept a second cell value for the Cell2 terminal and wiring in a 1D array instead of the single string. If you do modify it, be sure to save it under a different name, so you don't overwrite the original.
To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).
Try to take over the world! -
Associative array binding - poor performance
Dear All
i have very very low performence when i am inserting a binary array using associative array bind. i mean when i insert huge jagged binary array.
the jagged array has
BinarryArray[0][0]........BinarryArray[0][8000]
BinarryArray[1][0]........BinarryArray[1][8000]
BinarryArray[3600][0]........BinarryArray[3600][8000]
BinarryArray[0] - i have 8000 byte end so on. total is 3600 X 8000
that means 28,800KB hence to ~28MB.
the C# code is as follows
string strInsert "Insert Into T Values(t.SEQUENCE.currval, :paramArr);
OracleCommand objCommand = new OracleCommand;
OracleParameter objParam = new OracleParameter(paramArr, OracleDbtype.blob, 8000, system.data.ParameterDirection.Input,true,0,0,"ColumnName", system.data.DataRowVersion.Curren, BinarryArray);
objCommandtext = strInsert;
objCommand.ArrayBindCount = BinarryArray.Length;
objCommand.Parameters.Clear();
objCommand.Parameters.Add(paramArr);
objCommand.ExecuteNonQuery();
In generall the Insertion is good for each row in the array i get separate row in the DB but it works so slow.
why??????
see the code belowwell??
-
Procedure Array Binding a Null Value
Can you perform array binding in ODP.NET (to a procedure for example that inserts values) and assume that if there are null values in the array that the records inserted will have the corresponding null values in their records?
Here's a quick sample using pl/sql associative arrays to insert null values into a table (I think this is what you mean)...
SQL*Plus: Release 10.1.0.3.0 - Production on Fri Feb 18 09:38:55 2005
Copyright (c) 1982, 2004, Oracle. All rights reserved.
SQL> connect /
Connected.
SQL> create table null_array_insert
2 (
3 first_name varchar2(32) not null,
4 middle_name varchar2(32) null,
5 last_name varchar2(32) not null
6 );
Table created.
SQL> create or replace package null_array_test as
2 -- create a type for each column
3 type t_first_name is table of null_array_insert.first_name%type
4 index by binary_integer;
5
6 type t_middle_name is table of null_array_insert.middle_name%type
7 index by binary_integer;
8
9 type t_last_name is table of null_array_insert.last_name%type
10 index by binary_integer;
11
12 -- the procedures that will perform our work
13 procedure bulk_insert (p_first_name in t_first_name,
14 p_middle_name in t_middle_name,
15 p_last_name in t_last_name);
16 end null_array_test;
17 /
Package created.
SQL> create or replace package body null_array_test as
2 procedure bulk_insert (p_first_name in t_first_name,
3 p_middle_name in t_middle_name,
4 p_last_name in t_last_name) is
5 begin
6 forall i in p_first_name.first..p_first_name.last
7 insert into null_array_insert (first_name,
8 middle_name,
9 last_name)
10 values (p_first_name(i),
11 p_middle_name(i),
12 p_last_name(i));
13 end bulk_insert;
14 end null_array_test;
15 /
Package body created.
Here's the C# code:
using System;
using System.Data;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
namespace Associative
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
string connStr = "User Id=/";
OracleConnection oraConn = new OracleConnection(connStr);
oraConn.Open();
// create the command object and set attributes
OracleCommand cmd = new OracleCommand("null_array_test.bulk_insert", oraConn);
cmd.CommandType = CommandType.StoredProcedure;
// create parameter objects for each parameter
OracleParameter p_first_name = new OracleParameter();
OracleParameter p_middle_name = new OracleParameter();
OracleParameter p_last_name = new OracleParameter();
// set parameter type for each parameter
p_first_name.OracleDbType = OracleDbType.Varchar2;
p_middle_name.OracleDbType = OracleDbType.Varchar2;
p_last_name.OracleDbType = OracleDbType.Varchar2;
// set the collection type for each parameter
p_first_name.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
p_middle_name.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
p_last_name.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
// set the parameter values
p_first_name.Value = new string[4]{"First 1", "First 2", "First 3", "First 4"};
p_middle_name.Value = new string[4]{"Middle 1", "", "Middle 3", ""};
p_last_name.Value = new string[4]{"Last 1", "Last 2", "Last 3", "Last 4"};
// set the size for each array
p_first_name.Size = 4;
p_middle_name.Size = 4;
p_last_name.Size = 4;
// set array bind size for the columns since they
// are a variable size type (varchar2)
p_first_name.ArrayBindSize = new int[4]{32, 32, 32, 32};
p_middle_name.ArrayBindSize = new int[4]{32, 32, 32, 32};
p_last_name.ArrayBindSize = new int[4]{32, 32, 32, 32};
// add the parameters to the command object
cmd.Parameters.Add(p_first_name);
cmd.Parameters.Add(p_middle_name);
cmd.Parameters.Add(p_last_name);
// execute the insert
cmd.ExecuteNonQuery();
p_last_name.Dispose();
p_middle_name.Dispose();
p_first_name.Dispose();
cmd.Dispose();
oraConn.Dispose();
And after running the code:
SQL> select * from null_array_insert;
FIRST_NAME MIDDLE_NAME LAST_NAME
First 1 Middle 1 Last 1
First 2 Last 2
First 3 Middle 3 Last 3
First 4 Last 4
4 rows selected.
SQL> select * from null_array_insert where middle_name is null;
FIRST_NAME MIDDLE_NAME LAST_NAME
First 2 Last 2
First 4 Last 4
2 rows selected.
SQL>Hope that helps,
- Mark -
Error while insert data using execute immediate in dynamic table in oracle
Error while insert data using execute immediate in dynamic table created in oracle 11g .
first the dynamic nested table (op_sample) was created using the executed immediate...
object is
CREATE OR REPLACE TYPE ASI.sub_mark AS OBJECT (
mark1 number,
mark2 number
t_sub_mark is a class of type sub_mark
CREATE OR REPLACE TYPE ASI.t_sub_mark is table of sub_mark;
create table sam1(id number,name varchar2(30));
nested table is created below:
begin
EXECUTE IMMEDIATE ' create table '||op_sample||'
(id number,name varchar2(30),subject_obj t_sub_mark) nested table subject_obj store as nest_tab return as value';
end;
now data from sam1 table and object (subject_obj) are inserted into the dynamic table
declare
subject_obj t_sub_mark;
begin
subject_obj:= t_sub_mark();
EXECUTE IMMEDIATE 'insert into op_sample (select id,name,subject_obj from sam1) ';
end;
and got the below error:
ORA-00904: "SUBJECT_OBJ": invalid identifier
ORA-06512: at line 7
then when we tried to insert the data into the dynam_table with the subject_marks object as null,we received the following error..
execute immediate 'insert into '||dynam_table ||'
(SELECT887684 wrote:
ORA-00904: "SUBJECT_OBJ": invalid identifier
ORA-06512: at line 7The problem is that your variable subject_obj is not in scope inside the dynamic SQL you are building. The SQL engine does not know your PL/SQL variable, so it tries to find a column named SUBJECT_OBJ in your SAM1 table.
If you need to use dynamic SQL for this, then you must bind the variable. Something like this:
EXECUTE IMMEDIATE 'insert into op_sample (select id,name,:bind_subject_obj from sam1) ' USING subject_obj;Alternatively you might figure out to use static SQL rather than dynamic SQL (if possible for your project.) In static SQL the PL/SQL engine binds the variables for you automatically. -
Restful service unable to insert data using PL/SQL.
Hi all,
Am running: AL 2.01 standalone mode on OEL 4.8 in VM box A.
Oracle database 10.2.0.4 with Apex 4.2.0.00.27 on OEL4.8 in VM box B.
Able to performed oracle.example.hr Restful services with no problem.
Unable to insert data using AL 2.0.1 but works on AL 1.1.4.
which uses the following table (under schema: scott):
create table json_demo ( title varchar2(20), description varchar2(1000) );
grant all on json_demo to apex_public_user; and below procedure ( scott's schema ):
CREATE OR REPLACE
PROCEDURE post(
p_url IN VARCHAR2,
p_message IN VARCHAR2,
p_response OUT VARCHAR2)
IS
l_end_loop BOOLEAN := false;
l_http_req utl_http.req;
l_http_resp utl_http.resp;
l_buffer CLOB;
l_data VARCHAR2(20000);
C_USER_AGENT CONSTANT VARCHAR2(4000) := 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)';
BEGIN
-- source: http://awads.net/wp/2005/11/30/http-post-from-inside-oracle/
-- Ask UTL_HTTP not to raise an exception for 4xx and 5xx status codes,
-- rather than just returning the text of the error page.
utl_http.set_response_error_check(false);
-- Begin the post request
l_http_req := utl_http.begin_request (p_url, 'POST', utl_http.HTTP_VERSION_1_1);
-- Set the HTTP request headers
utl_http.set_header(l_http_req, 'User-Agent', C_USER_AGENT);
utl_http.set_header(l_http_req, 'content-type', 'application/json;charset=UTF-8');
utl_http.set_header(l_http_req, 'content-length', LENGTH(p_message));
-- Write the data to the body of the HTTP request
utl_http.write_text(l_http_req, p_message);
-- Process the request and get the response.
l_http_resp := utl_http.get_response (l_http_req);
dbms_output.put_line ('status code: ' || l_http_resp.status_code);
dbms_output.put_line ('reason phrase: ' || l_http_resp.reason_phrase);
LOOP
EXIT
WHEN l_end_loop;
BEGIN
utl_http.read_line(l_http_resp, l_buffer, true);
IF(l_buffer IS NOT NULL AND (LENGTH(l_buffer)>0)) THEN
l_data := l_data||l_buffer;
END IF;
EXCEPTION
WHEN utl_http.end_of_body THEN
l_end_loop := true;
END;
END LOOP;
dbms_output.put_line(l_data);
p_response:= l_data;
-- Look for client-side error and report it.
IF (l_http_resp.status_code >= 400) AND (l_http_resp.status_code <= 499) THEN
dbms_output.put_line('Check the URL.');
utl_http.end_response(l_http_resp);
-- Look for server-side error and report it.
elsif (l_http_resp.status_code >= 500) AND (l_http_resp.status_code <= 599) THEN
dbms_output.put_line('Check if the Web site is up.');
utl_http.end_response(l_http_resp);
RETURN;
END IF;
utl_http.end_response (l_http_resp);
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line (sqlerrm);
raise;
END; and executing in sqldeveloper 3.2.20.09 when connecting directly to box B as scott:
SET serveroutput ON
DECLARE
l_url VARCHAR2(200) :='http://MY_IP:8585/apex/demo';
l_json VARCHAR2(20000) := '{"title":"thetitle","description":"thedescription"}';
l_response VARCHAR2(30000);
BEGIN
post( p_url => l_url, p_message =>l_json, p_response => l_response);
END;which resulted in :
anonymous block completed
status code: 200
reason phrase: OK
with data inserted. Setup using 2.0.1
Workspace : wsdemo
RESTful Service Module: demo/
URI Template: test
Method: POST
Source Type: PL/SQLand executing in sqldeveloper 3.2.20.09 when connecting directly to box B as scott:
SET serveroutput ON
DECLARE
l_url VARCHAR2(200) :='http://MY_IP:8585//apex/wsdemo/demo/test';
l_json VARCHAR2(20000) := '{"title":"thetitle","description":"thedescription"}';
l_response VARCHAR2(30000);
BEGIN
post( p_url => l_url, p_message =>l_json, p_response => l_response);
END;which resulted in :
status code: 500
reason phrase: Internal Server Error
Listener's log:
Request Path passes syntax validation
Mapping request to database pool: PoolMap [_poolName=apex, _regex=null, _workspaceIdentifier=WSDEMO, _failed=false, _lastUpdate=1364313600000, _template=/wsdemo/, _type=BASE_PATH]
Applied database connection info
Attempting to process with PL/SQL Gateway
Not processed as PL/SQL Gateway request
Attempting to process as a RESTful Service
demo/test matches: demo/test score: 0
Choosing: oracle.dbtools.rt.resource.templates.jdbc.JDBCResourceTemplateDispatcher as current candidate with score: Score [handle=JDBCURITemplate [scopeId=null, templateId=2648625079503782|2797815111031405, uriTemplate=demo/test], score=0, scope=SecurityConfig [constraint=none, realm=NONE, logonConfig=LogonConfig [logonForm=null, logonFailed=null]], originsAllowed=[], corsEnabled=true]
Determining if request can be dispatched as a Tenanted RESTful Service
Request path has one path segment, continuing processing
Tenant Principal already established, cannot dispatch
Chose oracle.dbtools.rt.resource.templates.jdbc.JDBCResourceTemplateDispatcher as the final candidate with score: Score [handle=JDBCURITemplate [scopeId=null, templateId=2648625079503782|2797815111031405, uriTemplate=demo/test], score=0, scope=SecurityConfig [constraint=none, realm=NONE, logonConfig=LogonConfig [logonForm=null, logonFailed=null]], originsAllowed=[], corsEnabled=true] for: POST demo/test
demo/test is a public resource
Using generator: oracle.dbtools.rt.plsql.AnonymousBlockGenerator
Performing JDBC request as: SCOTT
Mar 28, 2013 1:29:28 PM oracle.dbtools.common.jdbc.JDBCCallImpl execute
INFO: Error occurred during execution of: [CALL, begin
insert into scott.json_demo values(/*in:title*/?,/*in:description*/?);
end;, [title, in, class oracle.dbtools.common.stmt.UnknownParameterType], [description, in, class oracle.dbtools.common.stmt.UnknownParameterType]]with values: [thetitle, thedescription]
Mar 28, 2013 1:29:28 PM oracle.dbtools.common.jdbc.JDBCCallImpl execute
INFO: ORA-06550: line 1, column 6:
PLS-00103: Encountered the symbol "" when expecting one of the following:
begin case declare exit for goto if loop mod null pragma
raise return select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge pipe
The symbol "" was ignored.
ORA-06550: line 2, column 74:
PLS-00103: Encountered the symbol "" when expecting one of the following:
begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
<an identifier> <a double-quoted delimited-id
java.sql.SQLException: ORA-06550: line 1, column 6:
PLS-00103: Encountered the symbol "" when expecting one of the following:
begin case declare exit for goto if loop mod null pragma
raise return select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge pipe
The symbol "" was ignored.
ORA-06550: line 2, column 74:
PLS-00103: Encountered the symbol "" when expecting one of the following:
begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
<an identifier> <a double-quoted delimited-id
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:447)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:879)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:505)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:223)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:205)
at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:1043)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1336)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3612)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3713)
at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4755)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1378)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at oracle.ucp.jdbc.proxy.StatementProxyFactory.invoke(StatementProxyFactory.java:242)
at oracle.ucp.jdbc.proxy.PreparedStatementProxyFactory.invoke(PreparedStatementProxyFactory.java:124)
at oracle.ucp.jdbc.proxy.CallableStatementProxyFactory.invoke(CallableStatementProxyFactory.java:101)
at $Proxy46.execute(Unknown Source)
at oracle.dbtools.common.jdbc.JDBCCallImpl.execute(JDBCCallImpl.java:44)
at oracle.dbtools.rt.plsql.AnonymousBlockGenerator.generate(AnonymousBlockGenerator.java:176)
at oracle.dbtools.rt.resource.templates.v2.ResourceTemplatesDispatcher$HttpResourceGenerator.response(ResourceTemplatesDispatcher.java:309)
at oracle.dbtools.rt.web.RequestDispatchers.dispatch(RequestDispatchers.java:88)
at oracle.dbtools.rt.web.HttpEndpointBase.restfulServices(HttpEndpointBase.java:412)
at oracle.dbtools.rt.web.HttpEndpointBase.service(HttpEndpointBase.java:162)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at com.sun.grizzly.http.servlet.ServletAdapter$FilterChainImpl.doFilter(ServletAdapter.java:1059)
at com.sun.grizzly.http.servlet.ServletAdapter$FilterChainImpl.invokeFilterChain(ServletAdapter.java:999)
at com.sun.grizzly.http.servlet.ServletAdapter.doService(ServletAdapter.java:434)
at oracle.dbtools.standalone.SecureServletAdapter.doService(SecureServletAdapter.java:65)
at com.sun.grizzly.http.servlet.ServletAdapter.service(ServletAdapter.java:379)
at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
at com.sun.grizzly.tcp.http11.GrizzlyAdapterChain.service(GrizzlyAdapterChain.java:196)
at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:662)
Error during evaluation of resource template: ORA-06550: line 1, column 6:
PLS-00103: Encountered the symbol "" when expecting one of the following:
begin case declare exit for goto if loop mod null pragma
raise return select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge pipe
The symbol "" was ignored.
ORA-06550: line 2, column 74:
PLS-00103: Encountered the symbol "" when expecting one of the following:
begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
<an identifier> <a double-quoted delimited-idPlease advise.
Regards
ZackZack.L wrote:
Hi Andy,
Sorry, forgot to post the Source that's use by both AL1.1.4 and AL2.0.1.
Source
begin
insert into scott.json_demo values(:title,:description);
end;
it's failing during the insert?
Yes, it failed during insert using AL2.0.1.
So the above statement produces the following error message:
The symbol "" was ignored.
ORA-06550: line 2, column 74:
PLS-00103: Encountered the symbol "" when expecting one of the following:
begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
<an identifier> <a double-quoted delimited-idThis suggests to me that an unprintable character (notice how there is nothing between the double quotes - "") has worked its way into your PL/SQL Handler. Note how the error is reported to be a column 74 on line 2, yet line 2 of the above block should only have 58 characters, so at a pure guess somehow there's extra whitespace on line 2, that is confusing the PL/SQL compiler, I suggest re-typing the PL/SQL handler manually and seeing if that cures the problem. -
Problem in reading a string back which was stored using custom binding.
Hi All,
i use below codes to do custom binding
public class CSVRecord {
private String key;
/** To keep how many values we have for a key.
* This is used to retrive values' element during constructing CSVRecord object back from stream.
private int valuesSize;
* to keep values for a key
private String[] values;
public CSVRecord()
public CSVRecord(String key, String[] values)
this.key = key;
this.values = values;
this.valuesSize = this.values.length;
public String getKey() {
return key;
public void setKey(String key) {
this.key = key;
public String[] getValues() {
return values;
public void setValues(String[] values) {
this.values = values;
public int getValuesSize() {
return valuesSize;
TupleBiniding code:
public class CSVRecordTupleBinding extends TupleBinding {
public void objectToEntry(Object object , TupleOutput tupleOutput)
CSVRecord record = (CSVRecord)object;
tupleOutput.writeString(record.getKey());
tupleOutput.writeInt(record.getValuesSize());
for(int i=0;i<record.getValuesSize();i++)
tupleOutput.writeString(record.getValues());
public Object entryToObject(TupleInput tupleInput) {
<font color="red"> String key = tupleInput.readString(); </font> <br>
int valuesSize = tupleInput.readInt();
String[] values = new String[valuesSize];
for(int i=0;i<valuesSize;i++)
values[i] = tupleInput.readString();
return new CSVRecord(key,values);
But when i reconstruct an object using cusom binding i face below exceptions
Caused by: java.lang.ArrayIndexOutOfBoundsException: 8
at com.sleepycat.util.UtfOps.getZeroTerminatedByteLength(UtfOps.java:38)
at com.sleepycat.bind.tuple.TupleInput.readString(TupleInput.java:150)
at com.ml.odr.regression.comparison.CSVRecordTupleBinding.entryToObject(CSVRecordTupleBinding.java:30)
at com.sleepycat.bind.tuple.TupleBinding.entryToObject(TupleBinding.java:73)
This is especially happens at the line where i read the key back.
could you please advise ?.
Thanks,
SriniHi Srini,
I don't see anything obviously wrong with the code you posted, except perhaps that the setter, setValues, does not update valuesSize -- you really don't need the valuesSize field, you can use the array length instead.
There must be something wrong elsewhere in your program. Please post a complete test program, that has a main() and can be run with only the JE jar file, that demonstrates the problem.
--mark -
How can I do to insert a 1D array in a line of a table or a 2D array ?
I have some vectors I concatenate in a 1D array when I pushed a button. Furthermore, when I pushed the same button, I would like to insert this 1D array in a line of a 2D array or in a line of a table. How can I do ?
Thanks.
Cyril.Hi,
to insert 1D array into 2D array you must use
Functions->Array->Insert Into Array.
Wire your 2D array to array input of this vi, then specify the row index you want your 1D array will be, and then wire your 1D array to element input. The output will be what you want. The length of all 1D arrays must be the same, otherwise you may loose some data.
If you want to add data to text table then you need first to convert your numeric array to textual form with
Function->String->String/Number Coversion VIs
Good luck.
The example is attached.
Oleg Chutko.
Attachments:
Insert.vi 17 KB -
Error using a binding to get current row data
Hi, from a previous post ( Calling a stored procedure ) that has been answered i have reached to this point and cant get go on:
i have a method declared on appmoduleimpl that calls to a procedure stored in the database and passes two parameters (one string, and one int)to the stored procedure.I drag and drop the method from the data control pallete to my jspx page.
the problem is that i want to get the value of two rows from the current record and set them as values from the parameters.
My Binding:
${bindings.Module3EmpIterator.currentRow.empno}
${bindings.Module3EmpIterator.currentRow.ename}
Note: Module3Emp its the name of my view
when i use this binding i get this error code
JBO-29000: javax.servlet.jsp.el.ELException: Unable to find a value for "ename" in object of class "oracle.jbo.server.ViewRowImpl" using operator "."
javax.servlet.jsp.el.ELException: Unable to find a value for "ename" in object of class "oracle.jbo.server.ViewRowImpl" using operator "."
JBO-29000: javax.servlet.jsp.el.ELException: Unable to find a value for "ename" in object of class "oracle.jbo.server.ViewRowImpl" using operator "."
javax.servlet.jsp.el.ELException: Unable to find a value for "ename" in object of class "oracle.jbo.server.ViewRowImpl" using operator "."
JBO-29000: javax.servlet.jsp.el.ELException: Unable to find a value for "ename" in object of class "oracle.jbo.server.ViewRowImpl" using operator "."
javax.servlet.jsp.el.ELException: Unable to find a value for "ename" in object of class "oracle.jbo.server.ViewRowImpl" using operator "."
Thanks.Here i store a pl/sql code in a method (At AppModuleImpl Level)
public void callProc1 (String ename,
int empno)
PreparedStatement plsqlBlock = null;
// String statement = "BEGIN p_proc1(:1,:2); END;";
String statement = "BEGIN INSERT INTO p_proc (ID, dato, numero) VALUES (s_proc.NEXTVAL, :1, :2); END;";
plsqlBlock = getDBTransaction().createPreparedStatement(statement,0);
try
plsqlBlock.setString(1,ename);
plsqlBlock.setInt(2,empno);
plsqlBlock.execute();
catch (SQLException sqlException)
throw new SQLStmtException(CSMessageBundle.class,
CSMessageBundle.EXC_SQL_EXECUTE_COMMAND,
statement,
sqlException);
finally
try
plsqlBlock.close();
catch (SQLException e)
// We don't really care if this fails, so just print to the console
e.printStackTrace();
now i expose the method and set the variables in the page definition.
<methodAction id="callProc1"
InstanceName="Module3AppModuleDataControl.dataProvider"
DataControl="Module3AppModuleDataControl"
MethodName="callProc1" RequiresUpdateModel="true" Action="999"
IsViewObjectMethod="false">
<NamedData NDName="ename"
NDValue="${bindings.Module3EmpIterator.currentRow.ename}"
NDType="java.lang.String"/>
<NamedData NDName="empno"
NDValue="${bindings.Module3EmpIterator.currentRow.empno}"
NDType="int"/>
(that does it automatically when i drag and drop the method to the jspx page).
This is the code in the command button inside the jspx page
<af:commandButton actionListener="#{bindings.callProc1.execute}"
text="callProc1"
disabled="#{!bindings.callProc1.enabled}"/>
When i click the button, the method should insert the selected column on a new table that i created But it doesn't. How i can do it, or how i can see the output of those values (bindings.Module3EmpIterator.currentRow.empno... etc.)
Note: when i hardcode the values and put Hello instead of bindings.Module3EmpIterator.currentRow.empno it inserts into the table and works everything fine.
Maybe you are looking for
-
Multiple Contracts VBAK-VBPA-VBPA2
Firslty, ,I am new to this site so please tell me (politely) if I have posted in the wrong place ! My operation is to extract Quanity Contract data, to use outside of SAP. For any given Ship-to/Material, report the Quanity Contract data. I have ident
-
Final cut pro x dissolves not working
Final Cut Pro X, dissolves not working, When I use Ribbon, Heart ect, they showup on the video flickering, will not allow me to render the video, any help would be greatly appreciated.
-
Download of xml file is incomplete
We have a system which serves xml files (datafeeds of products). Some customers have reported problems with downloading feeds. Further analysis showed that they were getting incomplete downloads. This problem could be circumvented by downloading in a
-
Itunes does not synchronize offline PSE 7.0 photos
In iTunes 8 (version 8.0.2.20), the photo sync feature allows to synchronize photos from a Adobe Photoshop Elements (PSE) album (e.g. version 7.0) and copy them onto your iPod. Improvement suggestion However, if your photo files happen to be backed u
-
Hi SAP, Please can one of them say the common movement types which is used in production eg..Goods Issue against production order , Goods reciept to warehouse etc... Thanks Balaji