Tables -- return values
Hi..I have a short question.
let's say I have a column of doubles in a table (DB).
if an entry in the column was null, what would java return?
for example::
columnA: (1.0, -2.3, 6.6, NULL, 8.3)
I suppose we're talking about database tables and therefore JDBC.
Consider the code:
ResultSet rs = stmt.executeQuery("SELECT ROUTERID FROM ROUTER");
while(rs.next()) {
double d = rs.getDouble("ROUTERID");
if (rs.wasNull()) {
d = Double.NaN;
}YES, the getDouble() returns 0 if the column is null; and YES, you can check whether the last column read was actually null.
But it's all in the API doc of ResultSet.
Is this what you were seeking for?
Best Regards,
Ivan
Similar Messages
-
How to create and execute a function whose return value is a table
hi folks ,
i would like know how to create and execute a function whose return value is a table ,
am new to pl/sql ,
my statement for the function is
SELECT ct.credential_code, c.expiration_date
FROM certifications c, credential_types ct
WHERE ct.crdnt_id = c.crdnt_id
AND c.person_id = person_id;
i would like to have the result of the above query as return value for the function.
Thanks in advance ,
Ashok.chi Ps ,
Can you please do small sample ,
that would help me in clear understanding
thanks in advance
ashok.c -
The return value of sqlcode when select an empty table in a proc code
Table: test
there is an empty table. But when I use "select * from test" in a proc code, I found the return value of sqlca.sqlcode is 0, not 1403 (NO MORE DATA). Why ?EXEC SQL DECLARE individual_cursor CURSOR for
SELECT IATA_C, DELAY, UPDATE_TIME
FROM TBL_TIME
WHERE IATA_C <> '***' AND
FLAG = 1;
EXEC SQL OPEN individual_cursor;
while(1) {
printf("in while");
if (sqlca.sqlcode == 1403 && individual_flag == 0) {
printf("no any data");
return 1;
} else if (sqlca.sqlcode == SQLNOMORE) {
break;
EXEC SQL FETCH individual_without_general_cursor INTO :pnrtime.airline, :pnrtime.delay, :pnrtime.update_time;
EXEC SQL CLOSE individual_cursor;
The result is:
in while
in while
no any data
Since the table is empty, why "in while" is printed twice? And "no any data" is printed in the end? I cannot decide the empty when using "select ... into" in proc unless using "select count(*) from test", right? Thx. -
How i pass table column value to string variable or return to java applete
Hi Master,
How do I pass a table column value into string variable. See my code below:
import java.sql.*;
public class Waheed {
public Waheed() {
public static void main (String args [])
String s = "9 23 45.4 56.7";
System.out.println ("going for connection");
// DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn =
DriverManager.getConnection("jdbc:oracle:thin:@fahim:1521:aamir","muhammad","mfa786");
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery("select accid from accbal");
System.out.println ("going for connection");
while (rset.next())
s= rset.getString("accid"); this line give me error
System.out.println (rset.getString("accid"));
System.out.println (s);
catch(Exception e){
e.printStackTrace();
This line give me an error:
s= rset.getString("accid");
s is string variable
Plese give me an idea how I can pass accid in s variable.
Thanks.
AamirSee the code sample in the following thread (try using upeercase).
JDBC connection
Kuassi -
Display and return value in select list.
hi,
i want to display the value in select list coming from this quary .
select student_id from class_record where class_id =:p1_class_id and SECTION =:p1_section
minus
select student_id from STUDENT_TYPE_DETAILS where class_id =:p1_class_id and SECTION =:p1_section;
but i want f_name and last name with student_id .f_name and l_name store in table s_per_det.student is also in that table.
how can i define display value and return value in this quary using 3rd table s_per_det.
How can i do this.
Thanks
manojOoh, MINUS.... Can you not use a NOT EXISTS in this case, could have a big effect on the execution plan?
Something like this perhaps?
SELECT f_name||' '||l_name,
stundent_id
FROM class_record a,
s_per_det b
WHERE a.student_id = b.student_id
AND a.class_id = :P1_CLASS_ID
AND a.section = :P1_SECTION
AND NOT EXISTS(SELECT 'X'
FROM student_type_details c
WHERE a.student_id = c.student_id
AND c.class_id = :P1_CLASS_ID
AND c.section = :P1_SECTION)Cheers
Ben
http://www.munkyben.wordpress.com
Don't forget to mark replies helpful or correct ;) -
How to get return values from stored procedure to ssis packge?
Hi,
I need returnn values from my stored procedure to ssis package -
My procedure look like and ssis package .Kindly help me to oget returnn value to my ssis package
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER PROCEDURE [TSC]
-- Add the parameters for the stored procedure here
@P_STAGE VARCHAR(2000)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
--SELECT <@Param1, sysname, @p1>, <@Param2, sysname, @p2>
truncate table [INPUTS];
INSERT
INTO
[INPUTS_BASE]
SELECT
[COLUMN]
FROM [INPUTS];
RETURN
END
and i am trying to get the return value from execute sql task and shown below
and i am taking my returnn value to result set variableYou need to have either OUTPUT parameters or use RETURN statement to return a value in stored procedures. RETURN can only return integer values whereas OUTPUT parameters can be of any type
First modify your procedure to define return value or OUTPUT parameter based on requirement
for details see
http://www.sqlteam.com/article/stored-procedures-returning-data
Once that is done in SSIS call sp from Execute SQL Task and in parameter mapping tabe shown above add required parameters and map them to variables created in SSIS and select Direction as Output or Return Value based on what option you used in your
procedure.
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
How can I use comma in the return values of a static list of values
Hi all,
I want to create a select list (static LOV) like the following:
Display Value / Return Value
both are "Y" / 'YY'
one is "Y" / 'YN','NY'
I write the List of values definition is like this:
STATIC:both are "Y"; 'YY',one is "Y";'YN', 'NY'
However, it is explain by htmldb like this:
Display Value / Return Value
both are "Y" / 'YY'
one is "Y" / 'YN'
/ 'NY'
I tried using "\" before the ",", or using single or double quote, but all these do not work:(
How can I use a comma in the return values?
Thanks very much!"Better still, why not process the code of both Y with 2Y and one is Y with 1Y? "
Could you please explain in detail? thanks! I am quite new to htmldb
In fact I have a table which has too columns "a1" and "a2", both the values of these two columns are "Y" or "N". AndI want to choose the records that both a1 and a2 are "Y", or just one of a1, a2 is "Y".
So I write the report sql like this:
"select * from t1 where a1 || a2 in(:MYSELECTLIST) "
Thus, I need to use "," in the LOV, since expression list in IN(,,,) using ",".
Any other way to implement this? -
I want to call Stored Procedure that return records and output parameter, from CVI
I can get output parrameter but when I want to get records stream I recieve following wrror:
function return value == -10. Native error code -2146824584 ADOBD.Recordset: Operation is not allowed when object is closedin Stored procedure I create table variable and and insert into string values
when I remove usage of table variable the error desappear -
How to retreive and display return value from BAPI
Hello,
I am using SUP to create a sales order application. In my MBO I have a create operation which calls a BAPI to create a sales order. How can I retrieve the return value (saled doc number) and display it on a screen and display it as an Alert of BB application.
Regards
Nidhideep BhandariHi David Brandow,
I have tried your solution where I just created a MBO for my 'operation' and I'm using sync parameters to execute the RFC.
The problem I'm facing is, for example, if I create a record it gets saved in the MBO table and the record successfully gets created in SAP as well after a sync. But when I create another record and sync, the previously saved record in MBO table also gets executed so I'm getting duplicate entries in SAP.
Have you or anyone faced this problem?
Any response is appreciated. Please let me know if I'm not clear, I realized its a complicated scenario.
Thanks,
Sandeep -
How to store the return value from a select list in page item ?
I'm sorry, I'm sure you will all flame me for this (and its long too :-(. I'm still trying to pick this up and havn't had time to read manual and this forum and up against the clock (as usual), but this must be something thats simple to do, otherwise why have 2 cols on LOV (display text and return value.
normal kind of thing - master /detail, a master table and a detail table, master.id is PK in master, master.name is the name of the master item. detail.id is pk in detail, detail.mid is foreign key to master.id. I have a tabular report that displays a join of cols from master and detail, with 2 cols being links, one is a link on master.name, that passes master.id to page P1 and it displays a row from master. The other col displays detail.name and passes detail.id to page P3, P3 displays a row of the detail table.
I want to populate a LOV with possible master.name values, but display the name of the current P3_MID value (from detail.mid). Then a user can pick a different master and it needs to update P3_MID so on submit it updates the row.
I just can't seem to see in the manual how you can specify where the return value on a LOV goes?
As I said, sorry for long post and not having had time to read docs correctly - someone just point me at the subject matter somewhere, please.Sorry, I was trying to be to complex and obviously APEX is just too damn cleaver - I figured out how this works - basically APEX pulls the LOV and then matchs the mid to it to display the correct name - simple and easy - just me making it difficult
-
How to set the returned value of CFL in a matrix
dear all,
I got a matrix binded to a DataSource and two CFLs are in this matrix. The codes for handling AfterChooseFromList is as following. It works almost fine. But when a docoment containing more than two
rows in the matrix and I reselect the CFL cell values more than two times, an error occured sometimes, not everytime. The error message is "This entry already exists in the following tables @CYW_PRROW [Message 131-183]"
I have tried to find out what kind of situation to cause this error, but still in the mud.
Can anybody give me some suggestion? Thanks.
Public Sub OnAfterChooseFromList_Matrix(ByVal pVal As SAPbouiCOM.ItemEvent)
Dim ActionSuccess As Boolean = pVal.ActionSuccess
Dim oform As SAPbouiCOM.Form = SBO_Application.Forms.Item(pVal.FormUID)
Dim oitem As SAPbouiCOM.Item = oform.Items.Item("mtx_0")
Dim omatrix As SAPbouiCOM.Matrix = CType(oitem.Specific, SAPbouiCOM.Matrix)
Dim oDataTable As SAPbouiCOM.DataTable
oDataTable = pVal.SelectedObjects
Dim val As String
Try
val = oDataTable.GetValue(0, 0)
Catch ex As Exception
End Try
omatrix.GetLineData(pVal.Row)
oform.DataSources.DBDataSources.Item("@CYW_PRROW").Offset = pVal.Row - 1
If pVal.ColUID = "col_0" Then
Try
oform.DataSources.DBDataSources.Item("@CYW_PRROW").SetValue("U_PRItemCode", pVal.Row - 1, CStr(val))
Catch ex As Exception
SBO_Application.MessageBox(ex.Message)
End Try
Else
Try
oform.DataSources.DBDataSources.Item("@CYW_PRROW").SetValue("U_PRSupp", pVal.Row - 1, CStr(val))
Catch ex As Exception
SBO_Application.MessageBox(ex.Message)
End Try
End If
omatrix.SetLineData(pVal.Row)
If pVal.FormMode = "1" Then
oform.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE
End If
End Sub
Another quesion, can I assign the returned value of CLF directly to the cell?Hello Chao-Yi Wu,
I don't have a real solution for you - just a few comments:
1. At
Try
val = oDataTable.GetValue(0, 0)
Catch ex As Exception
End Try
I would add
Try
if oDataTable Is Nothing Then Exit Sub ' If the User cancels the CFL
val = oDataTable.GetValue(0, 0)
Catch ex As Exception
End Try
2. At
If pVal.ColUID = "col_0" Then
I would make the branch by the pVal.ChooseFromListUID instead of the ColUID
and the 2nd not with "Else" but with "Else If ....."
3. It may work with EditText.String/Value of a cell but I never do that because of performance-reasons.
I always do it the same way as you in principle - I don't really know what the problem is.
4. Maybe some unique indexes on your table (although this should give an error at the update and not at CFL when "the unique-law is broken"...)?
Sorry - that's all for the moment.
Cheers,
Roland -
How to call an Oracle Procedure and get a return value in Php
Hi Everyone,
Has anyone tried calling an Oracle procedure from Php using the ora functions and getting the return value ? I need to use the ora funtions (no oci)because of compatibility and oracle 7.x as the database.
The reason why I post this here is because the ora_exec funtion is returning FALSE but the error code displayes is good. Is this a bug in the ora_exec funtion ?
My code after the connection call is as follows:
$cur = ora_open($this->conn);
ora_commitoff($this->conn);
$requestid = '144937';
echo $requestid;
$rc = ora_parse($cur, "begin p_ins_gsdata2
(:requestid, :returnval); end;");
if ($rc == true) {
echo " Parse was successful ";
$rc2 = ora_bind ($cur, "requestid", ":requestid", 32, 1);
if ($rc2 == true) echo " Requestid Bind Successful ";
$rc3 = ora_bind ($cur, "returnval", ":returnval", 32, 2);
if ($rc3 == true) echo " Returnval Bind Successful ";
$returnval = "0";
$rc4 = ora_exec($cur);
echo " Result = ".$returnval." ";
if ($rc4 == false) {
echo " Exec Returned FALSE ";
echo " Error = ".ora_error($cur);
echo " ";
echo "ErrorCode = ".ora_errorcode($cur);
echo "Error Executing";
ora_close ($cur);
The Oracle procedure has a select count from a table and it returns the number of records in that table. It's defined as:
CREATE OR REPLACE procedure p_ins_gsdata2 (
p_requestid IN varchar2 default null,
p_retcode OUT varchar2)
as
BEGIN
SELECT COUNT (*) INTO p_retcode
FROM S_GSMRY_DATA_SURVEY
WHERE request_id = p_requestid ;
COMMIT;
RETURN;
END;
Nothing much there. I want to do an insert into a table,
from the procedure later, but I figured that I start with a select count since it's simpler.
When I ran the Php code, I get the following:
144937
Parse was successful
Requestid Bind Successful
Returnval Bind Successful
Result = 0
Exec Returned FALSE
Error = ORA-00000: normal, successful completion -- while
processing OCI function OBNDRA
ErrorCode = 0
Error Executing
I listed the messages on separate lines for clarity. I don't understand why it parses and binds o.k. but the exec returns false.
Thanks again in advance for your help. Have a great day.
Regards,
Rudiretcode=`echo $?`is a bit convoluted. Just use:
retcode=$?I see no EOF line terminating your input. Your flavour of Unix might not like that - it might ignore the command, though I'd be surprised (AIX doesn't).
replace the EXEC line with :
select 'hello' from dual;
and see if you get some output - then you know if sqlplus commands are being called from your script. You didn't mentioned whether you see the banner for sqlplus. Copy/paste the output that you get, it will give us much more of an idea. -
Assigning LOV return Value to multiple text items
Hi all
I have a custom form on which i have 10 text items
text item 1,text item 2 ....text item10
I have a table xx_querywith fields
text_item,query
i have inserted into the xx_query table
insert into xx_query(text_item,query)
values(text_item1,'select sysdate from dual');
insert into xx_query(text_item,query)
values(text_item2,'select sysdate-1 from dual');
I have created a record group dynamically and i am getting the query from the query column of the xx_query table into the record group(say test_rg)
I have created a LOV test_lov and thr set_lov_property i have populated the test_rg query into the test_LOV
is it possible for me to set the return item of the LOV dynamically so that i can get the LOV on the item which i want to ?
thanks
_Hi All
thanks for your responses
I have Created a control item and assigned the return value of the LOV to the control item
and i have assigned the LOV to the text item that i want
Currently when i navigate to the text item the LOV is visible
but when i select a value from the LOV the value is not getting populated into the text item
I have assigned the value of the control item to the text item
but i am not sure in which trigger to write the code so as when i select the value from the LOV the value should be shown on the form populating in the text item
Thanks -
Invoke/db adapter get not the return value of a procedure
Hi,
I have a problem with a db adapter.
A db adapter calls a wrapper procedure and fill data in a object type.
the wrapper procedure call a procedure in a other schema.
In that schema the procedure make a insert in a database table
and give a return value(success_msg or error_msg).
schema1.pkg_wrapper.proc1(p_in IN schema2.param1_t,p_out out schema2.param2_t)
is
begin
schema2.pkg.proc1(p_in IN param1_t,p_out out param2_t)
end;
In one enviroment the bpel process running well in the second enviroment not.
I had found that the bpel process write in the database and the out parameter is filled with 'ok'.
But there ist a problem to transfer the value from the called procedure to the db adpater/invoke.
The releases of the application server and the database a the same, also the releases of jdeveloper.
My second problem the instance didn't comming back and the entry in the domain.log is
<2008-04-25 12:51:48,056> <WARN> <mmerkel.collaxa.cube> <BaseCubeSessionBean::logWarning> Error while invoking bean "finder": [com.collaxa.cube.engine.core.InstanceNotFoundException: Instance not found in datasource.
The process domain was unable to fetch the instance with key "2e52cdd31acca03e:5800031c:119819b87bf:-7bdd" from the datasource.
Please check that the instance key "2e52cdd31acca03e:5800031c:119819b87bf:-7bdd" refers to a valid instance that has been started and not removed from the process domain.
ORABPEL-02152
Instance not found in datasource.
The process domain was unable to fetch the instance with key "2e52cdd31acca03e:5800031c:119819b87bf:-7bdd" from the datasource.
Please check that the instance key "2e52cdd31acca03e:5800031c:119819b87bf:-7bdd" refers to a valid instance that has been started and not removed from the process domain.
and
<2008-04-25 13:47:53,666> <ERROR> <mmerkel.collaxa.cube.engine> <CubeEngine::processStaleInstance> Instance 2670008 has already been marked as stale ... skipping
<2008-04-25 13:47:53,672> <ERROR> <mmerkel.collaxa.cube> <BaseCubeSessionBean::logError> Error while invoking bean "instance manager": [com.collaxa.cube.engine.core.InstanceStaleException: Inconsistent process guid.
The instance "2670008" was created with process guid "MD5{ed3f0862561da5254a6cf2fd5a440500}"; the current guid for the process "bucheReo" (revision "1.0") is "MD5{0a8bf160d2ff79eabb2f4b479e876cd0}". Whenever a process is deployed on top of an existing process with the same process id and revision tag, all instances created from the previous process are marked as stale.
If you are accessing this instance from the console, your browser may be referring to an out-of-date page; please click on the Instances tab to get the current list of active instances.
ORABPEL-02032
Inconsistent process guid.
The instance "2670008" was created with process guid "MD5{ed3f0862561da5254a6cf2fd5a440500}"; the current guid for the process "bucheReo" (revision "1.0") is "MD5{0a8bf160d2ff79eabb2f4b479e876cd0}". Whenever a process is deployed on top of an existing process with the same process id and revision tag, all instances created from the previous process are marked as stale.
If you are accessing this instance from the console, your browser may be referring to an out-of-date page; please click on the Instances tab to get the current list of active instances.
Have anyone a idea?
Every help is welcome?
Thanks, MichaelHi,
“You should be able to use an assign to copy an output parameter value from the BPEL variable associated with the output parameter of the stored procedure.”
Yes, that is working well for the input variable. But that doesn’t work for the output variable in the second environment.
The whole bpel process working well in one environment and does not in the second.
By now I think there is any adjustment in the database or in the aplication server that we not found and that make the trouble
What I do is that a invoke element (Invoke_WriteREOInDB) call the db adapter WriteREOInDB. My input variable WriteREOInDB_InputVariable is filled, the db adapater call a procedure and I see my data in the table. Now the procedure gives the result value ‘ok’
In the invoke element I had the output variable WriteREOInDB_OutputVariable. In the next step I want to assign the value of WriteREOInDB_OutputVariable to my global output variable.
But the instance didn’t coming back. In the console I get the following message:
“Instance not found in datasource.
The process domain was unable to fetch the instance with key "2e52cdd31acca03e:5800031c:119819b87bf:-7e0b" from the data source.”
So I see nothing in the bpel console.
Any idea?
Thanks
Michael -
Problem with Bapi_po_Getdetail return values
We have developed a web service in asp.net to get the details of a particular purchase order number calling Bapi_po_Getdetail. The input parameters that we pass are:
string ITEMS = X
string PURCHASEORDER= <purchase order number>
But when we debug and check the return values from the bapi, BAPIEKPO Table doesnt have any data, it is null.
Could someone help us, please?Please initialize the BAPIEKPOTable bedore call. Passing null allways returns null.
NCo:
string ITEMS = X
string PURCHASEORDER= <purchase order number>
BAPIEKPOTable result = new BAPIEKPOTable();
proxy.Bapi_po_Getdetail(ITEMS, PURCHASEORDER, ref result);
Soap Processor / Web Service Wizard
string ITEMS = X
string PURCHASEORDER= <purchase order number>
BAPIEKPO[] result = new BAPIEKPO[0];
proxy.Bapi_po_Getdetail(ITEMS, PURCHASEORDER, ref result);
Maybe you are looking for
-
Coldfusion 64 bit windows installer stops working after recent microsoft update
Coldfusion 64 bit windows installation stops working after recent microsoft updates and how I worked around it. My question is at the end. Trying to deploy coldfusion 9 enterprise 64 bit trial version onto a Windows 2003 64 bit datacenter OS with al
-
How do I get a dotted line to connect nodes in a JTree?
I am trying to recreate a Windows Explorer application, does anyone know how they get the dotted lines to connect the nodes in the JTree????
-
Dimension table design Data modeling question
Hi Experts, Sorry if I am putting my question in a wrong forum and please suggest an appropriate forum. need your opinion on the existing design of our 10 years old datawarehouse. There is one dimension table with structure like following Dimension T
-
Webpart not rendering on migrated sites to 2013
I have migrated MOSS 2007 sites to SP 2013 using database attach/detach method, when i deploy the custom webparts i see below error on the migrated site: "Webpart error: A web Part or Web Form Control on the Page cannot be displayed or imported. The
-
Nokia N95 asks to reset date and time each time i ...
My N95 has started to request the date and time each time I swaitch it on. The battery is charged up . How do I stop this Thanks