I have a java stored procedure that takes in a clob representing a chunk of javascript and mins it. The structure of the function calling the JSP is as follows:
function MIN_JS(pcl_js in clob) return clob as
language java name 'JSMin.min(oracle.sql.CLOB) return oracle.sql.CLOB';
In the actual JSP, I have the following:
import oracle.sql.CLOB;
public class JSMin {
...
public static min(CLOB js) {
...
}
The problem I'm having is that whenever I pass a clob to JS_MIN, it is always interpreted as null inside the JSP. I've checked the clob before calling JS_MIN annd it definitely has contents. Any ideas as to what I'm missing? Any help is greatly appreciated.
As it turns out, one of the javascript chunks I was sending was in fact null. We have several packages that generate javascript for various controls and one is apparently still under development and wrapped in a way that it always returns null unless you are logged in as a particular user.
In my code, I loop across all the javascript packages, sending each to JS_MIN. Everything was working peachy until the package still in development came along and passed null. I added a simple check for null and everything works perfectly now.
So the short answer is: Doh!
Related
Below is part of my plsql code for webservice call, if am hardcoding lv_activity_token code is working fine,same is not working when am getting it from below expression
iv_offset_cnt:=0;
lv_activity_token:= substr(iv_activity_token,instr(iv_activity_token,'/',2)+1);--with this code is not working
--iv_activity_token is coming from oracle table which i stored in table from different web service response
-- lv_activity_token:='2562432'; hardcoding the same value which is coming from above expression,with this code is working
lv_ws_url:='https://secure.p03.eloqua.com:443/api/bulk/2.0/syncs/';
lv_ws_url1:='/data?limit=200&offset=';
gv_ws_url := lv_ws_url || lv_activity_token || lv_ws_url1 || iv_offset_cnt;
--at the end gv_ws_url value is:
--https://secure.p03.eloqua.com:443/api/bulk/2.0/syncs/2562432/data?limit=200&offset=0
additional detials:
gv_ws_url --passing this to get the response.
Please let me know if you need any other details.
(i was doubting with data which is storing in table(may be character set issue))
thanks in advance.
i try to get some records from DB Package (ORTAK.MERNIS) using its function (GETMERNISINFO(v_var number)) into PLL package type (MERNISLIB.MERNIS_USER).
But I ve a trouble with sending parameter to db package function (:TCK). It throws ORA-01008 : Not all variables bound
If I set function parameter statically (ORTAK.MERNIS.GETMERNISINFO(12345678)), it works as expected.
I use that code in Oracle Forms 6i
Any Ideas?
declare
MUSER MERNISLIB.MERNIS_USER;
begin
SELECT TCK,ADI,SOYADI INTO MUSER from table(cast(ORTAK.MERNIS.GETMERNISINFO(:TCK) as ORTAK.TCKTABLE));
:ADI := MUSER.ADI;
:SOYADI := MUSER.SOYADI;
end;
Looks like tck is coming from a text input item on the form. Can you try and fully qualify it as :block_name.item_name.
A library can't see the form items :ADI and :SOYADI because there is no guarantee the form the library is attached to will have them.
Use the COPY and NAME_IN functions to populate, or read form block items in a library procedure.
So, I was attempting to do something like the following:
if(Meteor.isServer){
Meteor.methods({connect_to_api: function(vars){
// get data from remote API
return data;
}});
}
if(Meteor.isClient){
Template.myTpl.content = function(){
Meteor.call('connect_to_api', vars, function(err,data){
Session.set('placeholder', data);
});
return Session.get('placeholder');
};
}
This seemed to be working fine, but, of course, now breaks in 0.5.9 as the Session object has been removed from the server. How in the world do you now create a reactive Template that uses a server-only (stuff we don't want loading on the client) method call and get data back from that Method call. You can't put any Session references in the callback function because it doesn't exist on the server, and I don't know of any other reactive data sources available for this scenario.
I'm pretty new to Meteor, so I'm really trying to pin down best-practices stuff that has the best chance of being future-proof. Apparently the above implementation was not it.
EDIT: To clarify, this is not a problem of when I'm returning from the Template function. This is a problem of Session existing on the server. The above code will generate the following error message on the server:
Exception while invoking method 'connect_to_api' ReferenceError: Session is not defined
at Meteor.methods.connect_to_api (path/to/file.js:#:#)
at _.extend.protocol_handlers.method.exception ... etc etc
Setting the session in the callback seems to work fine, see this project I created on github: https://github.com/jtblin/meteor_session_test. In this example, I return data in a server method, and set it in the session in the callback.
There are 2 issues with your code:
1) Missing closing brace placement in Meteor.methods. The code should be:
Meteor.methods({
connect_to_api: function(vars) {
// get data from remote API
return data;
}
});
2) As explained above, you return the value in the session, before the callback is completed, i.e. before the callback method had the time to set the session variable. I guess this is why you don't see any data in the session variable yet.
I feel like an idiot (not the first time, not the last). Thanks to jtblin for showing me that Session.set does indeed work in the callback, I went back and scoured my Meteor.method function. Turns out there was one spot buried in the code where I was using Session.get which was what was throwing the error. Once I passed that value in from the client rather than trying to get it in the method itself, all was right with the world.
Oh, and you can indeed order things as above without issue.
Really weird.
I have an Oracle function
function highlightDesc(desc IN VARCHAR2, keyword IN VARCHAR2) return VARCHAR2
return 'paragraphtag' ||
REPLACE(desc, keyword, 'boldtag' || keyword || 'boldtag') || 'paragraphtag';
this gets called this way
select a.*, highlightDesc(a.Desc) as highlightedDesc
from tablea a
The weird thing is that when I call this sql from within sqlplus or plsql developer the highlightedDesc column contains all the right markup.
When I call it from Junit, I get all the right markup.
When I call it from a struts2 app running on jboss(winxp/redhat) with the oracle thin drivers,
I get the enclosing paragraphtag tags and the content but not the boldtag .
Does that make sense?
Any thoughts?
Edit:
I apologize, I cant log into SO from work. Lame I know.
I am using the commons dbutils queryrunner (BeanListHandler) to execute the sql from a java class.
My action is doing nothing but calling my service class and setting the value.
I looked at the src for queryrunner, it ends up calling a class called BeanProcessor which gets the highlightedDesc column as a String via rs.getString(index);
I thought it might be an encoding problem??? so I tried to change the jvm encoding and also the jboss encoding, but it had no effect.
I think I might see if converting the character set in oracle has any effect?
Thanks.
Most likely, the keyword isn't passed correctly to the function, so the REPLACE function does effectively nothing.
Has anyone seen this error when trying to call an external C function from an Oracle query? I'm using Oracle 10g and get this error every time I try to call one of the two functions in the library. A call to the other function returns fine every time, though the function that works is all self-contained, no calls to any OCI* functions.
Here's the stored procedure that is used to call the failing C code:
CREATE OR REPLACE PROCEDURE index_procedure(text in clob, tokens in out nocopy clob, location_needed in boolean)
as language c
name "c_index_proc"
library lexer_lib
with context
parameters
(
context,
text,
tokens,
location_needed
);
Any help would be appreciated. Everything I've found on this error message says that the action to take is: Contact Oracle customer support.
Edit: I've narrowed it down to the point that I know that there is a segfault deep in libclntsh after I call OCILobTrim (to truncate it down to 0 length) on the tokens clob. Here is the code I've been using to call this procedure.
declare text CLOB; tokens CLOB;
begin
dbms_lob.createtemporary(tokens, TRUE);
dbms_lob.append(tokens, 'token');
dbms_lob.createtemporary(text, TRUE);
dbms_lob.append(text, '<BODY>Test Document</BODY>');
index_procedure(text, tokens, FALSE);
dbms_output.put_line(tokens);
end;
/
Is there something wrong with this setup that might be causing OCILobTrim problems?
It looks like this is one of those errors that essentially means any number of things could have gone wrong with the external procedure.
There is a known bug in 10.2.0.3, no idea if it's relevant:
ORA-28579 occurs when trying to select
data from a pipelined table function
implemented in "C" using the
ODCITable/ANYDATASET interface.
ODCITableDescribe works fine but
ODCITableFetch generates an ORA-28579
error.
I would suggest:
Look in the database server
trace directories, and the directory
where the external proc is located,
for any log or trace files generated
when the error occurs.
Instrument your external proc in
some way so that you can try to
trace its execution yourself.
Contact Oracle support
Well, an upgrade to 10.2.0.4 (was using 10.2.0.1) at least gave me an understandable error instead of a fairly useless core file and the ORA-28579.
It turns out that the code I was debugging was assuming that calling OCILobRead would return all of the data in one pass. This is the case for any client using a fixed width character set.
For clients using a variable width character set, this isn't the case, OCILobRead was actually reading part of the data and returning OCI_NEED_DATA and future calls to OCILobTrim and OCILobWrite were failing because of the still pending call to OCILobRead. The solution was to loop OCILobRead calls until OCI_NEED_DATA was no longer returned and we had all of the needed data in our buffer.
A call to OCIBreak also would have allowed the OCILobTrim and OCILobWrite functions to continue, though we wouldn't have had all of the needed input data.