Oracle Form functions and procedures in APEX, how?
I am working to recreate in APEX, already existing Read Only Forms in Oracle Forms. APEX Interactive Report functionality among other things, makes it worth while as well as targetting a different audience than the one that utilizies the Oracle Form versions. Oracle Forms versions use lots of pre and post query triggers, PLSQL Functions.
In Oracle Forms one of the places those functions can be located is in the "Program Units" section of the Form. A typical function of this sort, based on a specific Mission ID Itinerary, collects scheduled passengers last names, formats them with a comma and space after each one, into a single string that is returned and displayed as the passenger list of one row.
I have all this code written so I can move most of the main query of the Oracle Form into an Interactive Report. These functions and triggers called from within the Form, from the "Program Units" section of the Oracle Form rather than being stored in the Database schema in a package, where would they go inside APEX? Can I create a "Shortcut" in APEX and call it from the Interactive Report "Region Source"? Can I create the PLSQL function at the page level or region level of the Interactive Report? Or, is my best bet creating a package stored in the database, of all these functions and/or proecedures I may need from the original Oracle Form?
Some advice would be greatly appriciated.
RLBickham wrote:
I don't think I have been clear enough in describing the specific thing I want to do, it simply does not reach the level of forms to APEX conversion. It is basically a PLSQL Function problem.
I have an Interactive Report that is currently getting 90 percent of what I want however, each row, representing a Mission may have multiple legs. Each Leg has two locations or ICAO codes attached to it. Based on the Mission number, I want to loop through the leg table, collect all the ICAO codes for that Mission, put them all into 1 variable separated by a coma and add that variable to the column display of that Interactive Report as the last column.
In Oracle Forms I have a function saved to the database that is called within the main query. Maybe I am asking a question that does not need to be asked but in any case my question is can I put that function currently in the database somewhere in the confines of the Interactive Report and reference it via Http somehow or should I just stick with putting functions and procedures in packages stored in the database and called the conventional way?You could move the function to the database and call it from the report query, but it sounds as if it's superfluous. In the report query use whatever form of Re: 4. How do I convert rows to columns? is appropriate to your (unspecified) database version.
When you have a problem you'll get a faster, more effective response by including as much relevant information as possible upfront. This should include:
<li>Full APEX version
<li>Full DB/version/edition/host OS
<li>Web server architecture (EPG, OHS or APEX listener/host OS)
<li>Browser(s) and version(s) used
<li>Theme
<li>Template(s)
<li>Region/item type(s) (making particular distinction as to whether a "report" is a standard report, an interactive report, or in fact an "updateable report" (i.e. a tabular form)
With APEX we're also fortunate to have a great resource in apex.oracle.com where we can reproduce and share problems. Reproducing things there is the best way to troubleshoot most issues, especially those relating to layout and visual formatting. If you expect a detailed answer then it's appropriate for you to take on a significant part of the effort by getting as far as possible with an example of the problem on apex.oracle.com before asking for assistance with specific issues, which we can then see at first hand.
Similar Messages
-
How to run the Oracle Triggers,Functions and Procedures from java
Hi ,
I want to execute the Oracle's Triggers, Functions and Procedures from java as like executing the SQL commands by using Execute statements.
Or can we have some other option for doing this.
Plz help me ...you can use CallableStatement interface of JDBC to execute any DBMS triger,stored procedure ....
refer any of the JDBC book for extra help
hope you got it
Azeem Ahmed -
Calling Oracle Functions and Procedures in Java
I've looked online for a blurb on using Oracle SQL functions and
procedures in Java, but I haven't found anything. Can someone
either give me a quick crash course on this, or point me to the
best source of information for this?From the SQLJ FAQ.
http://otn.oracle.com/tech/java/sqlj_jdbc/htdocs/faq.html#sqljplsql
Within your SQLJ statements, you can use PL/SQL anonymous blocks
and call PL/SQL stored procedures and stored functions, as in the
following examples: Anonymous
block:
#sql {
DECLARE
n NUMBER;
BEGIN
n := 1;
WHILE n <= 100 LOOP
INSERT INTO emp (empno) VALUES(2000 +
n);
n := n + 1;
END LOOP;
END
Stored procedure call (returns the maximum
deadline as an output parameter into an output host expression):
#sql { CALL MAX_DEADLINE(:out maxDeadline) };
Stored function call (returns the maximum
deadline as a function return into a result expression):
#sql maxDeadline = { VALUES(GET_MAX_DEADLINE)
Of course, you can also use JDBC code to achieve the same - the
standard JDBC escape sequences for stored function and procedure
calls are supported, using for example:
"{? = CALL GET_MAX_DEADLINE}"
or:
"{call MAX_DEADLINE(?)}"
and for the rest of the details, get that JDBC crash course... -
Hi Friends,
My Question is : At what time we will use function and Procedure.? How i can prefer it?
Regards,
AnuFunctions are normally used for computations where as procedures
are normally used for executing business logic.
there can be many difference between stored procedures and functions
main are
1. function can be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section where as Stored procedures cannot be.
If you have a function in which there are DML statements only then you can not call this function in a SQL query
for example
For example, if you have a function that is updating a table, you cannot call that function from a SQL query.
- select myFunction(field) from sometable; will throw error.
But you can do it through procedure.
I hope it is clear -
Calling Oracle function and Procedure using OCCI with in C++ code
Could any body send me the sample code to create and execute Oracle function and Procedure using OCCI concept in C++?.
Edited by: 788634 on Aug 16, 2010 4:09 AMHi Vishnu,
Yes, sure, you can create a PL/SQL procedure, function, package, package body, etc. from within an OCCI application. I would say that, generally, this is not the sort of activity a typical client application would perform unless there is some initialization/installation processes that need to happen. In any case, here is a simple demo showing how to create a stand alone procedure (in a real application I would use a package and body) that returns a ref cursor. The ref cursor is just a simple select of two columns in the hr.countries sample table. Of course, there is no error handling, object orientation, etc. in this demo - I wanted to keep the code as short and as simple as possible to illustrate the concept.
Regards,
Mark
#include <occi.h>
#include <iostream>
using namespace std;
using namespace oracle::occi;
int main(void)
// occi variables
Environment *env;
Connection *con;
Statement *stmt;
ResultSet *rs;
// database connection information
string user = "hr";
string passwd = "hr";
string db = "orademo";
// sql to create the procedure which returns a ref cursor as out parameter
// should be run as hr sample user or in a schema that has select privilege
// on the hr.countries table and a synonym (countries) that points to the
// hr.countries table
string sqlCreate =
"create or replace procedure get_countries(p_rc out sys_refcursor) as "
"begin"
" open p_rc for"
" select country_id, country_name from countries order by country_name; "
"end;";
// pl/sql anonymous block to call the procedure
string sqlCall = "begin get_countries(:1); end;";
// create a default environment for this demo
env = Environment::createEnvironment(Environment::DEFAULT);
cout << endl;
// open the connection to the database
con = env->createConnection(user, passwd, db);
// display database version
cout << con->getServerVersion() << endl << endl;
// create statement object for creating procedure
stmt = con->createStatement(sqlCreate);
// create the procedure
stmt->executeUpdate();
// terminate the statement object
con->terminateStatement(stmt);
// now create new statement object to call procedure
stmt = con->createStatement(sqlCall);
// need to register the ref cursor output parameter
stmt->registerOutParam(1, OCCICURSOR);
// call the procedure through the anonymous block
stmt->executeUpdate();
// get the ref cursor as an occi resultset
rs = stmt->getCursor(1);
// loop through the result set
// and write the values to the console
while (rs->next())
cout << rs->getString(1) << ": " << rs->getString(2) << endl;
// close the result set after looping
stmt->closeResultSet(rs);
// terminate the statement object
con->terminateStatement(stmt);
// terminate the connection to the database
env->terminateConnection(con);
// terminate the environment
Environment::terminateEnvironment(env);
// use this as a prompt to keep the console window from
// closing when run interactively from the IDE
cout << endl << "ENTER to continue...";
cin.get();
return 0;
} -
How to istall oracle forms service and oracle reports service and testing
How to istall oracle forms service and oracle reports service ?
and we can make test?How to istall oracle forms service and oracle reports service ?http://download.oracle.com/docs/cd/B19375_07/doc/frs/docs.htm
and we can make test?Once installed, there is a test program both for Forms and Reports... or you mean something else ? if so, please clarify. -
How to use type, packages, functions, and procedures in another schema ?
I have two target schema in one OWB project, such as A and B. In a mapping of A, I would like to use some types, packages, functions, and procedures from B. I have tried the method of synonym as suggested, but I could not find the metadata of these when importing ... The only type of synonym I can import is the synonym for table. Is there a bug for synonym?
If I cannot use synonym for this issue, is there another way to solve the problem?Now, in some instances you will absolutely need to create the second module as Carsten describes, however it should also be noted that you can reference objects in things like Expressions even if you have not loaded up the metadata. It is only when you need strong binding that it becomes neccessary to import objects. For everything else, as long as the reference will resolve at compile-time then you are good to go.
For example, I have a function in one target schema (S1) and a private synonym to it in another(s2). A mapping in the S2 schema has an expression object that uses the synonym to the function in the expression property for a couple of the output attirbutes. The synonym has not been loaded into metadata - indeed OWB has no knowledge of its existance. But it resolves at compile time so the mapping validates and generates successfully.
Mike -
Data dcitioany view and function and procedures insure a package
I need the run a query on the Data dcitioany, to get a list of packages as well as a list for procedures and functions inside on Oracle 10g
I use DBA_SOURCE,
I used like this
SELECT v.owner,
(CASE V.type
WHEN 'FUNCTION' THEN NULL
WHEN 'PROCEDURE' THEN NULL
ELSE v.name
END
)PACKAGE_NAME ,
UPPER(
SUBSTR
TRANSLATE(
LTRIM(REPLACE(SUBSTR(ltrim(v.text),LENGTH('PROCEDURE')+1),'"',''),' '),
'+++'
),---TEXT TO BE SEARCH
1,---STARTING POSITION
INSTR(
TRANSLATE(
LTRIM(REPLACE(SUBSTR(ltrim(v.text),LENGTH('PROCEDURE')+1),'"',''),' '),
'+++'
||'+'
'+'
)-1 ---lENGTH
)OBJECT_NAME
TRIM(SUBSTR(ltrim(v.text),1,LENGTH('PROCEDURE')))"TYPE"
FROM dba_source v
WHERE (TRIM(ltrim(v.text)) LIKE ('FUNCTION%') OR TRIM(ltrim(v.text)) LIKE ('PROCEDURE%')) AND
v.type IN ('PACKAGE','FUNCTION','PROCEDURE')
ORDER BY V.OWNER,V.name,v.text;Note: the translate, substr, etc function can be simplified based on your needs
in my case, how developers created the function and procedure is quite messy.
thanks -
Drop all functions and procedures
How can I delete all functions and procedures by using Native Dynamic SQL
Loop against DBA_OBJECTS for the object_type and owner you want to delete.
For each loop, build your query into a variable, then execute it.
http://tahiti.oracle.com/pls/db102/drilldown?levelnum=2&toplevel=b14261&method=FULL&chapters=0&book=&wildcards=1&preference=&expand_all=&result_id=1662311&verb=&word=execute+immediate#b14261
Nicolas. -
License for Oracle Forms 6i and Oracle Reports 6i
Hai there,
May I know if I can buy a license for 2 users for the development tools Forms 6i and Reports 6i.
How do I go ahead and buy the license on line. Where do I contact.
Please give me the details.
Thanks in advance.
ElizabethPlease be aware that this version of Forms is desupported in one months time.
You can download the software from otn but you should contact your Oracle Account Manager about licensing.
Regards
Grant Ronald
Forms Product Management -
Oracle stored functions and where clauses
Hello everybody,
I need to call an Oracle stored function and at the same time do a select on
the result of the query, it works well except when I use a where clause. I
am connecting to Oracle 8.1.7 through OLEDB using the Oracle provider for
OLEDB distributed with this Oracle version.
Here is the query I am doing:
select * from {call MC.SEC.QryTermbases(?, ?) where ID = ?}
If I remove the where clause it works well but I need to use the where. I
know that I could pass the parameter to the procedure instead of doing that
in the select but there are places where I can not do that since the SQL
query is generated dynamically. The code above is just a demo.
Thanks very much for your help,
Jose.Thanks for answering, it is actually possible to do a select on the return of a function, I have tested it with other than "select *" and it has worked well. What has not worked for me is using a "where" clause. That is "select" without "where" has worked but not with the "where".
I also suspect that it does not work but similar queries work well in MSSQL 2000 and Interbase 6.0 so I thought may be there was a way to do that with Oracle. That is in MSSQL I can treat the result of a function as a normal table and I can do the same thing with a stored procedure that returns a recordset in Interbase.
Thanks again for answering,
Jose. -
Same algorithm in function and procedure then which one will better?
Why pl sql function is better to computes a value instead of procedure?
If I apply same algorithm in function and procedure then which one will perform better?It's not a matter of performance, it is more a matter of how it is going to be used.
A function can be used as an expression in an assignment or in a query.
my_var := my_func(my_param);
select my_var(my_col) from my_table;But it can just return a single value (which can be a complex value like a nested table or object or ref cursor, but still a single value.)
The procedure often is more used to perform an action that does not return anything.
execute_invoicing(my_invoice_id);Or procedures can be used if you need multiple return values.
my_proc(my_input, my_output_1, my_output_2, my_output_3);But the procedure cannot be used in an assignment expression or a select query.
Performance wise procedures and functions are completely identical. It is only a matter of what action they perform and how you are going to use them. -
Exact difference between function and procedure
exact difference between function and procedure(real time diff.....not like return value, dml....) and function do some work at the same time that work also do procedure..why function
ranitB wrote:
1. Function is called Inline a query. A return value is must.
But, procedure may/may not contain a return value.Not true.
A function may be called in a query providing it meets certain limitations (no DDL, or transactional statements such as commit/rollback etc.).
A function does not have to be called from a query, it can be called from other PL/SQL code or from other external applications.
Regular functions must return a value, though pipelined functions do not...
SQL> CREATE OR REPLACE TYPE split_tbl IS TABLE OF VARCHAR2(32767);
2 /
Type created.
SQL> CREATE OR REPLACE FUNCTION split (p_list VARCHAR2, p_delim VARCHAR2:=' ') RETURN SPLIT_TBL PIPELINED IS
2 l_idx PLS_INTEGER;
3 l_list VARCHAR2(32767) := p_list;
4 l_value VARCHAR2(32767);
5 BEGIN
6 LOOP
7 l_idx := INSTR(l_list, p_delim);
8 IF l_idx > 0 THEN
9 PIPE ROW(SUBSTR(l_list, 1, l_idx-1));
10 l_list := SUBSTR(l_list, l_idx+LENGTH(p_delim));
11 ELSE
12 PIPE ROW(l_list);
13 EXIT;
14 END IF;
15 END LOOP;
16 RETURN;
17 END SPLIT;
18 /
Function created.
SQL> SELECT column_value
2 FROM TABLE(split('FRED,JIM,BOB,TED,MARK',','));
COLUMN_VALUE
FRED
JIM
BOB
TED
MARK... whilst the definition of the function shows a return type, the return statement inside the function simply returns, without a value. That's because the data is passed back through a special "pipeline", and you can write code to show that the data is available to a query as soon as it's piped, and before the function has completed (reached the return statement) if you like.
A procedure does not return a value (And no an OUT parameter is not a "returned" value, it's a writeable parameter, there's a difference)
2. There are some limitations in functions which is possbl through procedures.
Like - Oracle doesn't support DML in functions called in Select queries (using PRAGMA AUTONOMOUS_TRANSACTION will help).Not strictly true. and SQL query is considered to be DML, so a function could perform a query and then be used inside another query...
SQL> ed
Wrote file afiedt.buf
1 create or replace function f_dname(p_deptno in number) return varchar2 is
2 v_dname varchar2(10);
3 begin
4 select dname into v_dname
5 from dept
6 where deptno = p_deptno;
7 return v_dname;
8* end;
SQL> /
Function created.
SQL> ed
Wrote file afiedt.buf
1* select empno, ename, f_dname(deptno) as dname from emp
SQL> /
EMPNO ENAME DNAME
7369 SMITH RESEARCH
7499 ALLEN SALES
7521 WARD SALES
7566 JONES RESEARCH
7654 MARTIN SALES
7698 BLAKE SALES
7782 CLARK ACCOUNTING
7788 SCOTT RESEARCH
7839 KING ACCOUNTING
7844 TURNER SALES
7876 ADAMS RESEARCH
7900 JAMES SALES
7902 FORD RESEARCH
7934 MILLER ACCOUNTING
14 rows selected.It's been discussed many times on the forum... my favourite here...
{message:id=1668675}
Edited by: BluShadow on 17-Sep-2012 09:22 -
Double quotes in function and procedure names when using impdp
When viewing a function in the original database, it looks like:
CREATE OR REPLACE FUNCTION TA_ACTIVITY_D_GEN_FNC
After doing an expdp and impdp to restore a development database, it now looks like
CREATE OR REPLACE FUNCTION "TA_ACTIVITY_D_GEN_FNC"
and also has 2 blank lines at end of function.
This causes us problems when trying to use various utilites to compare differences in production and development. Now every function and procedure shows up as being different.
Can someone please explain why and what can be done to avoid this from happening?
Edited by: user6116705 on Jun 15, 2010 7:52 AMfrom old exp, here is the first line of the create procedure statement:
CREATE FORMAT71 PROCEDURE "SECURE_DML"
You can see the double quotes. I don't understand why you wouldn't see the same compare issue with old exp. I was wondering what you were using for compare since it would let me know where to look for anything that has changed from the original create to the create performed by data pump. I remember there being an issue in this area. I just don't remember if it was extra spacing, upcasing, or something else or multiple changes. You could contact Oracle support to see if there is a fix and if it is backported to your version.
The only other way you can possibly fix this (and it would be a huge pain) would be to run impdp with a sqlfile and then edit the sqfile to remove the double quotes and to remove any extra spacing/extra lines. A patch from Oracle would certainly be easier if one was available.
Dean -
Differnce between function and procedure....
Hi Experts,
I have query,When will use procedure or function..
means:
in what situation we will use fuction,
and which scenario will use procedure?
Can you please explain....?
Thanks in advance....992368 wrote:
Hi Experts,
I have query,When will use procedure or function..
means:
in what situation we will use fuction,
and which scenario will use procedure?
Can you please explain....?
Thanks in advance....Did you try to search this forum. This question has been asked lot of time. The search feature is not very good here may be use GOOGLE with the SITE tag to search. [url http://www.google.com/#safe=strict&output=search&sclient=psy-ab&q=site:forums.oracle.com+function+vs+procedure&oq=site:forums.oracle.com+function+vs+procedure&gs_l=hp.3...6856.24993.0.25236.54.43.6.0.0.0.428.9494.0j10j21j6j1.38.0...0.0...1c.1.15.psy-ab.eIfpP4zL0fM&pbx=1&bav=on.2,or.r_qf.&bvm=bv.47244034,d.cGE&fp=2bbc6037bd7feb17&biw=1024&bih=597]Something like this
Maybe you are looking for
-
Problem Previewing Spry in Browser
Hi, I've been following the Adobe online tutorials, and I'm failing miserably with Spry. Even the pre-worked, finished example files will not display properly in Internet Explorer 7. I refer to the files regarding "Using the Spry Framework for Ajax"
-
File type in Spotlight and Finder search
I have several lectures that are all Keynote presentations (both 08 and 09) and wanted to make a smart folder to have them all in one place. However, doing that, I realized that my Keynote files are not listed as "Presentations" but rather as "Docume
-
Problem re-downloading applications on nokia E71
I installed some applications like fring,youtube,facebook.Yesterday i formatted my memory card so these applications gone,but the problem is i cant downoad again these applications from ovi store.can anybody help how to make it possible to re downloa
-
Hello, Is anyone interested in talking to me about development opps? Thanks!
-
Authorization Object for data downloading from application server
Hi friends , My program downloads and uploads data from the application server . My requirement is , Authorization checks should be performed on the Server directories to ensure that the user has access to read and write to the directory. It shou