SQL functions in forms
Hi
I am using forms 4.5 and I have the following code in one of the program untis.
SELECT trim(leading '-' from nvl(SUM(nvl(TRANS_QTY,0)),0)) NET
FROM inventories
WHERE TRANS_QTY LIKE '-%' ;
i.e I want the sum of all the quantities dispatched. For received quantities, it is + and for dispatched, it is -.
The above code works fine in SQL plus session. When used in forms, it returns
encountered the symbol '-' when expection one of the following.........error.
Please suggest.
Thanks.
As of now, I used abs instead of trim and performed desired operation.
SELECT abs(SUM(nvl(TRANS_QTY,0))) NET
FROM inventories
WHERE TRANS_QTY LIKE '-%' ;
I woudl like to know if it is possible to use trim (SQL functions) or not.
Thanks.
Similar Messages
-
Equivalent Sql function for Forms NAME_IN() built in
Please let me know, is there any equivalent Sql function equivalent to Forms Name_in() built in. Thanks.
What would such a function do in pure SQL? Or are you asking if you can refer to Forms variables in SQL that you issue from Forms?
The answer to the first question I will delay until you define what it is that you want to do. The answer to the second question is that there is no way to do that. The database has no way of knowing how to resolve references to variables defined in client side PLSQL. -
Calling a pl/sql function from oracle forms
I have written a pl/sql function in a package.
package name- sup
function name - func
I have written a when-button-pressed trigger .from here I want to call this function.
How can I do that?
Please help..Thanks a lot..
User may select 20-30 check boxes for respective name & id...then at the end , user will hit OK...from here when-button-click will call a procedure....that will update/insert/delete a table data.The procedure I have written is:-
DECLARE
N_CNT Number(1);
D_SYSDATE Constant date :=sysdate;
Begin
select count(1)
into N_CNT
from dbtable L
where L.land_id = :BLK1.LAND_ID and
L.Operatoer_id = :BLK1.Operatoer_id and
L.suppl_id = :BLK1.suppl_id and
L.suppl_prof_id = :BLK1.suppl_prof_id;
if ((N_CNT = 0) and (:LANDLISTE.state = 'A')) then
insert into dbtable
LAND_ID,
STATE,
suppl_prof_id,
suppl_id,
OPERATOER_ID,
SIDST_OPD_DATO,
SIDST_OPD_INIT
values
:BLK1.LAND_ID,
'Y',
:BLK1.suppl_prof_id,
:BLK1.suppl_id,
:BLK1.Operatoer_id,
D_SYSDATE,
:BLK1.SIDST_OPD_INIT
elseif
((N_CNT>0 )and (:LANDLISTE.state = 'A')) then
update dbtable L
set L.SIDST_OPD_DATO = D_SYSDATE,
L.SIDST_OPD_INIT = :BLK1.SIDST_OPD_INIT
where L.land_id = :BLK1.LAND_ID and
L.Operatoer_id = :BLK1.Operatoer_id and
L.suppl_id = :BLK1.suppl_id and
L.suppl_prof_id = :BLK1.suppl_prof_id;
elseif ((N_CNT>0 ) and (:LANDLISTE.state = 'D')) then
delete from dbtable L
where L.land_id = :BLK1.LAND_ID and
L.Operatoer_id = :BLK1.Operatoer_id and
L.suppl_id = :BLK1.suppl_id and
L.suppl_prof_id = :BLK1.suppl_prof_id;
end if;
end;
Will it be able to load multiple data(20-30 at a time) to the table?
Should I write anything to commit the data in the table?
I am very new to oracle forms...please help.. -
How to use SQL function in Tabular Form
Edited by: JuniorNewbi on 03-Nov-2009 08:15
Hi
I want to have a Tabular Form in which the Report Source sql statement is retrieved via an SQL function, so that the resulting report can show a variable number of columns and column names.
The following great web site shows just the kind of thing i'm trying to do (Tabular Form Dynamic):
http://htmldb.oracle.com/pls/otn/f?p=31517:195:518536699796436::NO:::
However, as an Apex newbie, i don't know how to invoke the SQL function from within the page. The "Report Source" appears to only allow a static "select...." style of entry.
I don't have access to the Denes Kubicek's workspace so don't know how he would have invoked his PL/SQL Function.
Can anyone help?
Thanks in advance!
Edited by: JuniorNewbi on 03-Nov-2009 08:46 -
How to call a SQL function from an XSL expression
Hi
In R12, in Payroll Deposit adivce/Check writer, We need to sort the earnings tag <AC_Earnings> in to two different categories as regular and other earnings. In the DB and form level of element defintiion we have a DFF which differentiates between the two kinds of earnings. But the seeded XML that is gerneated by the check writer does not have this field.
The seeded template displays all the earnings in one column. How can we achieve this in the template without modifying the seeded XML.
The one approach i have is to write a function and based on the return value sort the data. For this I need to know :
1) How to call a SQL function from an XSL expression that is allowed in BI template.
If anyone ahs faced similar requirements please share your approach.
Thanks
SrimathiThank u..
but i'd seen that link wen i searched in google..
Is it possible without using any 3rd party JARs and all?
and more importantly plz tell me what should be preferred way to call a javascript function?
Do it using addLoadEvent() or Windows.Load etc
OR
Call it thru Xsl? (I donno how to do dis)
Thanks in Advance..
Edited by: ranjjose on Jun 3, 2008 8:21 AM -
Is it possible to retrieve RAD's extended variables with a pl/sql function?
Good morning everyone,
We have our forms and reports(10g) application, SSO enabled and we are using OID on 10g app server. some of our users use smart card to log in to the system and some who do not have smart cards provide their database userid, password and SID.
In the case of users who login with smart card, as a one time effort, they have to register their smart card. At that point OID presents a form prompting for their username, password, sid and then a RAD record is created for that particular user.
And from then on when the user enters the system using his smart card(12345@mil), forms servlet, does the look up of dbusername,dbpswd,sid which belong to the 12345@mil and user's database credentials are passed to the application. The entire application logic is based on that userid which is also an internal userid in the application. Everything is working fine.
I have read the documentation and found that 12345@mil is stored in the "cn" parameter and the orclownerguid and orclusernameattribute are stored under "cn"=extended properties in the oid. I am able to see this from the oid console.
But now I need some help. If I only know the id of the user as "12345@mil" , is it possible to manually query the RAD and retrieve the orclusername from a pl/sql function?
Any help is greatly appreciated.
Regards,
Suma.Please can anyone help me????
Regards,
Suma. -
For each row of a table call a pl/sql function
Hi,
i have a search form in adf like this:
parameter1:___
parameter2:____
buttonSearch
Table with results
field1 field2 field3
row1 ------ --------- -------
row2 ------ --------- -------
row3 ------ --------- -------
The user inputs the parameters 1 and 2 then press buttonSearch and the query execute and returns rows 1 to 3.
What i need is for each row call pl/sql function and passed the parameter 1 and 2 and field 1 to 3 (plsql function recives 5 parameters (parameter1, parameter2, field1 , field2 and field3) )
my buttonSearch call a java class that execute ExecuteWithParamters method.
I create the call to my plsql function on Application module class and then export as a java interface.
So i have the function to use in the viewcontroller layer, but i don't know where to use it, and how to pass the paramters: the parameter 1 and 2 that user inputs and the row fields.....
any ideas....
thanks!!Hi,
for this you need to call the PLSQL function upon table rendering, which means that you need a field in the table referencing a managed bean. In the managed bean you can use #{row} and resolve it using a ValueExpression. #{row} gives you access to the current rendered row (this is why you need to do it when the table renders) and thus allows you to call getAttribute(name) to get the values of field 1 - 3. The search field value you should get through the bindings reference (assuming the search form uses ADF). Then you create an operation binding for the executeWithParameters and call operationBindingName.getParamsMap().put(argname, argvalue); on it.
Frank
Ps.: I am concerned about the performance you get and wonder if it isn't possible to create a transient attribute that executes the function and displays the results. As I understand, the search parameters are only to filter the result set, which you still can do -
Sql Functions in AttributeQualification?
Using the CMSDK Search API, is there a way to use a SQL function in an AttributeQualification, without using the FreeFormQualification? (I'm using CMSDK 9.0.4)
My need is that I would like to make queries ignoring the accentued characters of the attribute values. I wondered doing this by applying a custom "normalizer" function on the attribute values in the attribute qualification. If it will not be possible, I will use free-form qualifications.
Thanks.
Daniel.The FreeFormQualification works fine for applying Sql functions on simple attributes. However, it is not that simple to do the same to array attributes, because the values are stored in another table.
Please, how could I apply SQL functions on array attributes without having to reverse engineer the search API's behavior?
Thanks!
Daniel. -
Calling pl/sql function in controller
HI all
i have a problem in calling a pl/sql function in a controller..
the question is can we call a pl/sql function in a controller if so
will the code below works???
String invoice_id=getInvoiceId().toString();
Number Invoice_amount=getAmount();
DBTransaction txn = getDBTransaction();
String Filesql="BEGIN SELECT sum(AMOUNT_REMAINING) into :1 FROM ap_payment_schedules_all where invoice_id=:2;END;";
OracleCallableStatement Filecs=(OracleCallableStatement)txn.createCallableStatement(Filesql,1);
String AmountRemaining = "";
try{
Filecs.registerOutParameter(1, OracleTypes.VARCHAR, 0, 100);
Filecs.setString(2,invoice_id);
Filecs.execute();
AmountRemaining=Filecs.getString(1);
Filecs.close();
catch(SQLException sqle){
try { Filecs.close(); } catch (Exception e) {;}
throw OAException.wrapperException(sqle);
when i write the above code in a controller ..it is saying getDBTransaction not defined....
can u help me out in this...String RuleName=pageContext.getParameter("CashRule");
String OrgId=pageContext.getParameter("OrgId");
String TransType=pageContext.getParameter("TransactionType");
OAApplicationModule am = (OAApplicationModule)pageContext.getApplicationModule(webBean);
OADBTransaction txn = am.getOADBTransaction();
String Filesql="BEGIN select cle_f246_return_anal_mod_pkg.ret_anal_module(:2,:3,:4) into :1 from dual;END;";
OracleCallableStatement Filecs=(OracleCallableStatement)txn.createCallableStatement(Filesql,1);
String AnalyticalModule = "";
try{
Filecs.registerOutParameter(1, OracleTypes.VARCHAR, 0, 100);
Filecs.setString(2,TransType);
Filecs.setString(3,RuleName);
Filecs.setString(4,OrgId);
Filecs.execute();
AnalyticalModule=Filecs.getString(1);
Filecs.close();
catch(SQLException sqle){
try { Filecs.close(); } catch (Exception e) {;}
throw OAException.wrapperException(sqle);
this is the code i wrote in controller processformRequest...all the parameters are showiing correct values...but i am getting following error at Filecs.close();
org_id is of type Number but i am passing that as a string as setString accepts only strings...will that cause ne problem???
the error is:
oracle.apps.fnd.framework.OAException: java.sql.SQLException: ORA-01722: invalid number ORA-06512: at line 1 at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:896) at oracle.apps.cle.f246.webui.CashReportDetailsCO.processFormRequest(CashReportDetailsCO.java:88) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:813) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:382) at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1178) at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1025) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:991) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:846) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:382) at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1025) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:991) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:846) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:382) at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363) at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2840) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1834) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:532) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:420) at OA.jspService(_OA.java:75) at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:453) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:591) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:515) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:711) at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:368) at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:866) at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:448) at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:216) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:117) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:110) at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260) at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239) at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34) at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880) at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303) at java.lang.Thread.run(Thread.java:595) ## Detail 0 ## java.sql.SQLException: ORA-01722: invalid number ORA-06512: at line 1 at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288) at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743) at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:215) at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:967) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1168) at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3327) at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3433) at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4394) at oracle.apps.cle.f246.webui.CashReportDetailsCO.processFormRequest(CashReportDetailsCO.java:82) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:813) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:382) at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1178) at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1025) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:991) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:846) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:382) at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1025) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:991) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:846) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:382) at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363) at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2840) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1834) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:532) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:420) at OA.jspService(_OA.java:75) at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:453) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:591) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:515) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:711) at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:368) at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:866) at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:448) at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:216) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:117) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:110) at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260) at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239) at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34) at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880) at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303) at java.lang.Thread.run(Thread.java:595) java.sql.SQLException: ORA-01722: invalid number ORA-06512: at line 1 at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288) at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743) at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:215) at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:967) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1168) at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3327) at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3433) at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4394) at oracle.apps.cle.f246.webui.CashReportDetailsCO.processFormRequest(CashReportDetailsCO.java:82) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:813) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:382) at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1178) at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1025) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:991) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:846) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:382) at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1025) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:991) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:846) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:382) at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363) at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2840) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1834) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:532) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:420) at OA.jspService(_OA.java:75) at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:453) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:591) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:515) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:711) at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:368) at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:866) at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:448) at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:216) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:117) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:110) at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260) at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239) at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34) at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880) at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303) at java.lang.Thread.run(Thread.java:595) -
Using PL/SQL Table in Forms
Hi,
I am populating a PL/SQL table by fetching data through a explicit cursor. But when i am accessing the PL/SQL table after population, i am getting a "NO DATA FOUND" error.
I am attaching the Forms local progam units which have the logic.
PACKAGE f_get_bike_makers IS
TYPE prectype_maker_dtls_pll IS RECORD (
country_code ad_bike_maker_details.abmd_country_code%TYPE,
country_name table_values.tvs_description%TYPE,
manu_code ad_bike_maker_details.abmd_manufacturer_code%TYPE,
maker_name ad_bike_maker_details.abmd_maker_name%TYPE,
maker_name_kana ad_bike_maker_details.abmd_maker_name_kana%TYPE,
const_by ad_bike_maker_details.abmd_constructed_by%TYPE,
const_time ad_bike_maker_details.abmd_construction_time%TYPE,
update_by ad_bike_maker_details.abmd_updated_by%TYPE,
update_time ad_bike_maker_details.abmd_updated_time%TYPE
TYPE ptabtype_maker_dtls_pll IS TABLE OF prectype_maker_dtls_pll
INDEX BY BINARY_INTEGER;
FUNCTION f_get_bike_makers_pll RETURN ptabtype_maker_dtls_pll;
END;
PACKAGE BODY f_get_bike_makers IS
FUNCTION f_get_bike_makers_pll
RETURN ptabtype_maker_dtls_pll
IS
CURSOR cur_maker_dtls
IS
SELECT abmd.abmd_country_code,
tvs.tvs_description,
abmd.abmd_manufacturer_code,
abmd.abmd_maker_name,
abmd.abmd_maker_name_kana,
abmd.abmd_constructed_by,
abmd.abmd_construction_time,
abmd.abmd_updated_by,
abmd.abmd_updated_time
FROM ad_bike_maker_details abmd,
table_values tvs
WHERE abmd.abmd_country_code = tvs.tvs_code
AND tvs.tvs_tad_code = 'COUNTRIES'
ORDER BY abmd.abmd_country_code;
ln_tab_index BINARY_INTEGER := 0;
ltab_maker_dtls ptabtype_maker_dtls_pll;
BEGIN
FOR lcur_maker_dtls IN cur_maker_dtls
LOOP
ln_tab_index := ln_tab_index + 1;
ltab_maker_dtls (ln_tab_index) := lcur_maker_dtls;
END LOOP;
RETURN ltab_maker_dtls;
END f_get_bike_makers_pll;
END;
PROCEDURE f_populate_maker_names
IS
ltab_maker_dtls f_get_bike_makers.ptabtype_maker_dtls_pll;
lb_record_group BOOLEAN;
ln_ltab_maker_dtls_index BINARY_INTEGER;
BEGIN
-- read all the vehicle types from table_values
-- get makers and countries
ltab_maker_dtls := f_get_bike_makers.f_get_bike_makers_pll ;
DELETE_GROUP_ROW ('REC_MAKER_NAME', all_rows);
ln_ltab_maker_dtls_index := ltab_maker_dtls.FIRST;
begin
WHILE ln_ltab_maker_dtls_index IS NOT NULL
LOOP
lb_record_group := l_record_group.insert_value ('REC_MAKER_NAME',
'ABMD_MANUFACTURER_CODE',
ltab_maker_dtls (ln_ltab_maker_dtls_index).manu_code,
ln_ltab_maker_dtls_index
lb_record_group := l_record_group.insert_value ('REC_MAKER_NAME',
'ABMD_MAKER_NAME',
ltab_maker_dtls (ln_ltab_maker_dtls_index).maker_name,
ln_ltab_maker_dtls_index
lb_record_group := l_record_group.insert_value ('REC_MAKER_NAME',
'COUNTRY_NAME',
ltab_maker_dtls (ln_ltab_maker_dtls_index).country_name,
ln_ltab_maker_dtls_index
lb_record_group := l_record_group.insert_value ('REC_MAKER_NAME',
'ABMD_COUNTRY_CODE',
ltab_maker_dtls (ln_ltab_maker_dtls_index).country_code,
ln_ltab_maker_dtls_index
ln_ltab_maker_dtls_index := ltab_maker_dtls.NEXT (ln_ltab_maker_dtls_index);
end;
END LOOP;
exception when no_data_found then
message('ln_ltab_maker_dtls_index :'||ln_ltab_maker_dtls_index);
message(' ');
end;
ltab_maker_dtls.DELETE;
END;
SQL> desc ad_bike_maker_details
Name Null? Type
ABMD_COUNTRY_CODE NOT NULL VARCHAR2(2)
ABMD_MANUFACTURER_CODE NOT NULL VARCHAR2(2)
ABMD_MAKER_NAME VARCHAR2(60)
ABMD_MAKER_NAME_KANA VARCHAR2(60)
ABMD_CONSTRUCTED_BY NOT NULL VARCHAR2(20)
ABMD_CONSTRUCTION_TIME NOT NULL DATE
ABMD_UPDATED_BY VARCHAR2(20)
ABMD_UPDATED_TIME DATE
SQL> desc table_values
Name Null? Type
TVS_TAD_CODE NOT NULL VARCHAR2(15)
TVS_CODE NOT NULL VARCHAR2(15)
TVS_DESCRIPTION NOT NULL VARCHAR2(70)
Oracle Database Version
=======================
Oracle8 Enterprise Edition Release 8.0.6.1.0 - Production
PL/SQL Release 8.0.6.1.0 - Production
Forms Version
==============
Forms [32 Bit] Version 5.0.6.8.0 (Production)
PL/SQL Version 2.3.4.0.0 (Production)
Please do let know what could be the possible source of error.
Thanks in advance.
NitinBut we have to use the PL/SQL table as per our design standards.
We are implementing the population logic of the PL/SQL table in the database as a
package function. We are then accessing the PL/SQL table in Forms to populate the record group.It is curious that you would have such a unique requirement -- something that might make forms run a tiny bit faster -- yet you are using an ancient version of Forms.
Also the "NO DATA FOUND" error is not raised everytime the PL/SQL table is accessed.
What could be the reason for this erratic behaviour?I wonder if there may be a bug in SQL Net in the Oracle-to-Forms communication where PL/SQL tables are passed as out parameters. I know there is one in Web Forms 6 (6.0.8.19.1) when passing a pl/sql table from the form to Oracle -- I had to write the pl/sql table to a database table to get my process to work. -
How to use COALESCE function in Forms 6i?
Hi folks,
Please help me out in using function COALESCE in the forms 6i (front-end code).
My front-end application has got Oracle9i as back-end. At the database server side, in SQl * Plus, the function is executing perfectly but not in Forms6i.
Please help me out with you suggestions.
Your favour will be deeply appreciated.
Cheers, PCZ.This is a PL/SQL equivalent to the COALESCE function:
CREATE OR REPLACE function F_Coalesce
PC$List IN VARCHAR2,
PC$Sep IN VARCHAR2 DEFAULT ','
) Return Varchar2
Is
-- PL/SQL function that return the first non-null value
-- (equivalent to COALESCE SQL function)
LC$String VARCHAR2(32767) := PC$Sep || PC$List ;
LI$i PLS_INTEGER ;
LI$i2 PLS_INTEGER ;
LC$Value VARCHAR2(4000) ;
LN$Pos PLS_INTEGER := 1 ;
BEGIN
LI$i := INSTR( LC$String, PC$Sep, 1, LN$Pos ) ;
While LI$i > 0 Loop
LI$i2 := INSTR( LC$String, PC$Sep, 1, LN$Pos + 1) ;
IF LI$i2 = 0 Then LI$i2 := LENGTH( LC$String ) + 1 ; END IF ;
LC$Value := SUBSTR( LC$String, LI$i+1, LI$i2 - LI$i-1 ) ;
If LC$Value IS NOT NULL Then
Return LC$Value ; -- return the first non-null value
End if ;
LN$Pos := LN$Pos + 1 ;
LI$i := INSTR( LC$String, PC$Sep, 1, LN$Pos ) ;
End loop ;
Return Null ;
End ;
/And the test call:
SQL> set serveroutput on
SQL>
SQL> Declare
2 t varchar2(1) := null ;
3 v1 varchar2(100) := t || ',' || t || ',A,' || t || ',B' ;
4 v2 varchar2(100) := t || ',' || t ;
5 v3 varchar2(100) := 'A,' || t ;
6 a varchar2(100) ;
7 Begin
8 a := F_coalesce(v1) ;
9 dbms_output.put_line('result v1 =(' || a || ')');
10 a := F_coalesce(v2) ;
11 dbms_output.put_line('result v2 =(' || a || ')');
12 a := F_coalesce(v3) ;
13 dbms_output.put_line('result v3 =(' || a || ')');
14 End;
15
16 /
result v1 =(A)
result v2 =()
result v3 =(A)
PL/SQL procedure successfully completed.Hope this helps you,
Francois -
Help w/MaxDB Function; also: how does the "Debug SQL" function work?
Hi there forum folks,
In my former life, I was a Basis guy, but I haven't had the pleasure of working directly with SAP applications in a few months. My current project is to attempt to use MaxDB in a real estate environment. We're tracking home listings so that we can build statistical reports... such as "what agents are in the Top 100 in postal code X?"
Anyway, as part of this project, I have attempted to construct my very first MaxDB database function. Unfortunately, it doesn't give me the answers I'm hoping to see. Here's the function:
CREATE FUNCTION COUNT_LISTINGS (AGENTID CHAR(10)) RETURNS FIXED(6,1) AS
VAR COLISTINGAGENTID CHAR(10);
LISTINGAGENTID CHAR(10);
MLSNUMBER CHAR(7);
UNITS FIXED(6,1);
SET UNITS = 0;
DECLARE FUNCTIONRESULT CURSOR FOR
SELECT MLSNUMBER,
LISTINGAGENTID,
COLISTINGAGENTID FROM FREDDIE.GLAR_SOLDS
WHERE LISTINGAGENTID = :agentid OR COLISTINGAGENTID = :agentid;
IF $COUNT IS NULL THEN
BEGIN
CLOSE FUNCTIONRESULT;
RETURN UNITS;
END
ELSE
SET $RC = 0;
WHILE $RC = 0 DO BEGIN
FETCH FUNCTIONRESULT INTO :mlsnumber, :listingagentid, :colistingagentid;
IF ( LISTINGAGENTID = AGENTID AND COLISTINGAGENTID IS NULL ) OR
( COLISTINGAGENTID = AGENTID AND LISTINGAGENTID IS NULL ) THEN
SET UNITS = UNITS + 1
ELSE
SET UNITS = UNITS + 0.5;
END;
CLOSE FUNCTIONRESULT;
RETURN UNITS;
I've tried to follow the official MaxDB documentation. My first deviation from that standard was the use of the "$COUNT" variable (instead of the "$RC" variable) immediately after the DECLARE/SELECT statement above. When I tried to use $RC, for either a successful or unsuccessful query, $RC was always set to a non-zero value.
I believe I'm past that, but now my issue is down around that FETCH statement. The UNITS variable doesn't end up with the value I expect. I know that it can be terribly confusing to try to analyze someone else's logic, but here's a brief narrative that describes what I'm trying to do...
The GLAR_SOLDS table holds one line for each home sold. It's keyed by the MLSnumber. Each record also stores up to four agents who've been involved in the transaction: the listing agent, the co-listing agent, the selling agent, and the co-selling agent. The database function I've written above pertains to the listing side only. If I can get this to work, a separate function will process the selling side. If no co-listing agent is involved in a given sell, that agent should get credit for 1 unit sold. If he/she has help from a co-listing agent, the agent should only get credit for 1/2 unit sold.
Also, does anyone know how the "Debug SQL" functionality is supposed to work within Database Studio? When I right-mouse click on my function, and follow the path thru "Debug As...", after entering the connection & function arguments, I'm presented with an empty screen. If you could point me to some documentation somewhere, I'd gratefully read it.
I'm using MaxDB 7.7.06.09 on Windows XP (WIN32) with MaxDB Database Studio 7.7.06.09 (build 009-123-202-944).
Thanks everyone for your help & advice.
~FredFred,
please either provide the full SQL statements for your example or stick with mine.
I'm not going to build it up myself a second time to suit yours now.
> But now, my issue is how do I store the resultant data in its own table?
So where is the problem?
INSERT INTO <target table> (field 1, field 2, ...) (<your query>) UDPATE DUPLICATES-
With my tables this looks like this:
create table sell_result (list_agent varchar(20) primary key, SUM_CREDIT fixed (10,2))
insert
into sell_result (list_agent,sum_credit)
( select list_agent, sum (credit) as SUM_CREDIT
from ( select sh.object_id,lag.name as list_agent, 1 as credit
from soldhomes sh join agents lag on lag.id = sh.list_agent_id
union all
select sh.object_id, lag.name as list_coagent, 0.5 as credit
from soldhomes sh join agents lag on lag.id = sh.list_coagent_id
group by list_agent
update duplicates
Check what we have now
sqlcli db770=> select * from sell_result
| LIST_AGENT | SUM_CREDIT |
| -------------------- | ----------------- |
| Lars | 4.50 |
| Lisa | 3.00 |
| Mona | 2.50 |
| Paul | 2.50 |
4 rows selected (600 usec)
Now add some sales data...
Insert into soldhomes values (11, 1, 2, NULL, NULL)
Insert into soldhomes values (12, 2, NULL, NULL, NULL)
Insert into soldhomes values (13, 2, NULL, NULL, NULL)
Re-run the INSERT command and you're done:
sqlcli db770=> select * from sell_result
| LIST_AGENT | SUM_CREDIT |
| -------------------- | ----------------- |
| Lars | 5.50 |
| Lisa | 3.00 |
| Mona | 5.00 |
| Paul | 2.50 |
4 rows selected (390 usec)
Neat, isn't it? -
Read consistency in query with pl/sql functions
Not sure if this is a bug or feature, but a query containing a user-defined pl/sql function does not include tables accessed within the pl/sql function in the read consistent view of data, eg
select myfunc from tableA
myfunc is a stored function that queries tableB and returns a value
If a change to tableB is committed in another session during fetch phase of select statement, then fetched rows reflect the changes. The database does not recognise tables accessed in the plsql function as being part of the query.
This happens in 7.3.4 and 8.1.6. Don't have 9i so can't tell.
Anyone know if this is a bug or feature?
Aside: you can also drop the plsql function whilst the fetch is running. It will kill the fetch. No DDL lock taken on the plsql function whilst select is running! Seems wrong.I don't know Forms but I know SQL*Plus and Oracle database. Normally PL/SQL running on the database can only access files on the host where the database instance is running even if you start PL/SQL with a SQL*Plus connection from another host.
PL/SQL runs only the database instance not on the client side even if you start the PL/SQL code from a remote connection with SQL*Plus. -
Use Row Selector in PL/SQL Function
Hi all!
I want to use the ROW SELECTOR from a Tabular Form in a PL/SQL Function or Anonymous Block.
In Detail I want to find out which Rows got checked and then do specific operations to them.
Thanks in Advance.
Regards
Kai EilertHi,
I have a similar requirement. Need to add a Row selector in a report based on SQL query(PL/SQL function body returning SQL query). How do I do this?
TIA -
Bg_absence_duration sql function not working in Self Services
I Have SQl Function registered and used in formula BG_ABSENCE_DURATION, it is working fine in the professional forms, but in "Leave management" form in self services it gives error:
PER_EMP_NUMBER not found at line 231 of bg_absence_duration Cause: a sql select statement obtained from application dictionary return no rows when executed.
Edited by: Elrefai on May 29, 2013 10:11 PMHi Jay,
were you finally able to access DFF in BG_ABSENCE_DURATION , did the following piece of code worked ?
IF ABS_INFORMATION_CATEGORY = 'CA'
THEN
(If ABS_INFORMATION3 = 'Half Day'
THEN
( IF date_start = date_end THEN
(deduct_days = 0.5
days_between = days_between - deduct_days
duration = to_char(days_between) return duration, invalid_msg
ELSE
( duration = 'FAILED'
invalid_msg = 'Half day leave can be applied only for a day'
return duration, invalid_msg
Maybe you are looking for
-
How to draw vertical lines in SMART FORMS
Hi Guys, Can anyone please let me know how to draw vertical and horizontal lines in smart forms, i have to do this in the secondary window. thanks, Ramesh
-
How to Deploy application in CE 7.1 Nwds
Dear Friends i managed to install CE7.1 recently, now i selected a webdynpro perspective and created a simple application configured the portal appilcation server with nwds using Window > Preferences > SAP AS Java (gave server name and last digit of
-
Iphone sync is making me crazy how can I get data to and from my iphone without syncing?
I'm a pc user and i'm sick of the iphone sync process jacking up my life when I decide to reinstall windows and the old itunes data is no longer there. how can I etup my iphone to not have to sync but transfer data to and from it like an android?
-
How to create different log files for different users in log4j
I want to create different logs for different users, using different appenders for each user so that logs are created in his file only. Confusion:How to direct them to different files in my logger class
-
Cannot launch photoshop because of scratch file error (Win 7 64bit)
Hello all, I work at a school district and we have a class that uses photoshop but some fail to open due to a scratch file being locked. Now, we use Deepfreeze on all student computers in the district, that being said we force all domain users that l