PL/SQL functions as LOV to use in another display object
Hello
We had a custom search to extract data from a display object and the data displayed as a Table of ADF. Now, there are few requests for searches on this report. Go see criteria and Panel request if we allow saved search. But the fields used in the research are going through a lot of logic and thus the PL/SQL functions are implemented. We used to call these functions and lists separated by commas and then divided the list into individual elements and put in the component "select options".
The value (String) returned by the pl/sql function is something like - APAC, EMEA, NORTH AMERICA, FDA
I am creating a LOV based on SQL-query "Select getRegions() from dual;
Now, I want the list separated by commas to divide so that I could use this LOV in an another view and try the display criteria and saved searches.
I tried to assign as LOV just to check and the criteria drop-down view for region displays same value as single element - "APAC, EMEA, NORTH AMERICA, LAD."
I want it to be 4 separate - elements
APAC
EMEA
NORTH AMERICA
DVL
Is there anyway to achieve this?
Or better is at - it another way to do this (maybe I'm wrong)
Thank you.
JDev: 11.1.2.4
Instead of a programmatic VO of PL/SQL, I found sometimes easier to write PL/SQL functions that return a table - need to CREATE a TYPE for the data items to be returned and a TYPE of TABLE IMBRIQUE tabular form of the first kind. The function returns the type of table, and can even be a PIPElined table function. Then I create a VO with the following text:
SELECT * from TABLE (my_function_returning_table)
The function can even take parameters, which you fill with variable BIND your VO.
Tags: Java
Similar Questions
-
Use variables to display object in Captivate 4
I would like to be able to display a check mark next to title on the table of contents page once the user displays the last page in the section. Is it possible that I can do this, and where can I find the code?
Thank you
You can use variables to show/hide elements on a page.
First add custom variables to represent the State of completion of each section. Something like sectionOneCompleted = 0, sectionTwoCompleted = 0, etc..
Then add assignments for each of your variables at the end of each section. For example, you could define "on slide enter ' use 'assign' and give variable sectionOneCompleted set to 1.
Then in your table of contents you can show/hide the elements on the page depending on the value of your new user-defined variables.
1. go in the slide properties
2. under ' Navigation: on the slide, type ' select 'execute the Advanced Action '.
3. click on the... button next to 'the Action '.
4. under change/create an Action, select 'create '.
5. the action of giving a name such as ShowHideThingie
6. in the area of large text, double-click the text of 'Statement add' light gray. Gray 'add a statement' become a red "declaration". Double-click it again.
7. Select 'condition' in the menu drop-down
8. click 'Select a variable' and choose your variable defined by the user (in this case, "sectionOneCompleted")
9. choose "is equal to" and then enter a value of 1
10. then, you must specify what to do if the value is 1. Under 'start' double-click 'Add education '. Select 'action Standard' in the menu dropdown.
11. Select 'View', then select the name of the object that you want to display (each item placed on the blade has a unique ID)
12. now, we need to specify what happens if the value is NOT 1. Under 'otherwise... start', double click 'Add education '. Select 'action Standard' in the menu dropdown.
13. Select 'Hide', and then select the name of the object that you are showing to step 12.
14. click "Save" and close the window of the Actions dialogue box.
This should be it!
Note: I have not tested these steps carefully (written very quickly), but I hope you get the idea and can get out of here.
-philip
-
Analyze: Body of PL/SQL function returning a SQL query
I need to get the final SQL returned by the PL/SQL function.
I'll use this final SQL in a procedure.
Please provide only a few tips on how to get the SQL code. I already looked in the DBMS_SQL package, but I don't know if this is the right place to look.
Kind regards
Sumitdeclare l2 varchar2(2000); begin l2:= 'Select NAME,ORIGINATED,OWNER,ORIGINATOR,'; l2:= l2 || 'DESIGNATED_UNIT,SOURCE,'; l2:= l2 || 'REFERENCE'; l2:= l2 || ' from MV_DETAILED_DATA'; /* Copy dynamic query SQL to application item for later use. */ :app_item := l2; wwv_flow.debug('l2: ' || l2); return l2; end;
I always use a call of debugging in the region of body of the PL/SQL function returning a SQL query sources so the real generated SQL can be quickly entered via the debug mode.
-
Unable to do the sql union in a display object
Hi all
I have 2 tables and I want to run a query union sql against them. But in the view object, I get the message;
Support for declarative query does not currently include the UNION, INTERSECT or LESS.
Is there a way to get the sql query with the unions, executed in a display object.
I use version 10.1.3.5 for Jdeveloper/ADF.
Thank you very much
AmitHello
Not sure if it will work.
Try to create the view with a single query and after object after it is created, change the view object and modify the SQL query in the source.
Something like
TO
Arun-
PS: I am able to create the view with union declarative object in JDev 11 g. Probably you can switch to 11 g;).
-
Using the custom on a box SQL PL/SQL function
Hello
Is it OK to use or the PL/SQL a SQL box-custom functions? Or is - against the standards? Thank you.What are the standards, the answer is Yes and no.
-A function that returns a SYS_REFCURSOR will NOT work
-A PIPELINED function and return a TABLE (a TYPE of OBJECT) will workSELECT id as PER_ID, description as EMAILID FROM TABLE(my_func('1234567890'));
-A function returning a variable work
SELECT PER_ID, my_func(:F1) AS PER_INFO FROM CI_PER WHERE PER_ID = :F1;
-
assign a value to a text element using the PL/SQL function body
Hello
I want to assign a value to a text element using PL/SQL function body option in the Source elements. But the below error when I try to apply it.
Source code:
declare
name varchar2 (100);
Start
If v ("P3_CREHIDD") = 'Edit' then
Select ename in the name of cpy_emp where empno = v('P3_EMPNO2');
end if;
end;
ERR-1904 unable to calculate the default item: type = computation_type = function body declare name varchar2 (100); so start v ('P3_CREHIDD') = 'Edit' and then select ename in the name of cpy_emp where empno = v('P3_EMPNO2'); end if; end;.
Thank you
David.Hello
Your body of the function doesn't return anything.
Maybe it worksdeclare l_name varchar2(100); begin if v('P3_CREHIDD') = 'Edit' then select ename into l_name from cpy_emp where empno = v('P3_EMPNO2'); end if; RETURN l_name; end;
BR, Jari
-
APEX shortcuts using the source of the body of the PL/SQL function
Hi all
Recently, I came across the feature of "Shortcuts" in the "Shared components" section of the APEX and thought great, somewhere to set the common/standard items once, then use these several times in different pages of my application.
This seemed to work correctly when you use the 'Source' of "HTML Text" or "HTML text with special characters escaped", but then I wanted to explore the use of the "Body of the PL/SQL function" option to create a more dynamic shortcut/variable on the base.
This is where I came across a particular problem in the APEX (Version 3.2.1.00.10 on GR 11, 2 on Oracle Enterprise Linux). When I set my shortcut, and then perform a reference to my shortcut (using "MY_SHORTCUT") in an area of a page, the value of shortcut is back, but is added with the reference variable (ie. the 'MY_SHORTCUT' chain).
For simplicity, my example looks like this (of course, my real world example is a bit more complicated, but this example produces the same error):
(a) I define my shortcut called "MY_SHORTCUT" and using the body of the PL/SQL function under "Source Type", define my procedure as "htp.p(:USER)."
(b) I then create a new page (basic HTML page), and a new region of the 'type'-> 'HTML Text (with shortcuts).
(c) in the "Source region", I define my shortcut like - "MY_SHORTCUT".
(d) I apply changes and then run the page.
I'll be back will be name of the current user with "MY_SHORTCUT" appended/added immediately after the user name - for example. the string:-' BRAD «MY_SHORTCUT»»
Question is - how to stop the shortcut/reference text "MY_SHORTCUT" to be added to the variable you want to see the and thereafter on your page? I am just wanting the variable, NOT the reference for the shortcut. I do something wrong using the HTP package, and if yes, what should I use?
If "MY_SHORTCUT" is defined as "HTML text with special characters escaped" (where I can refer to elements of application using the syntax '& USER.') so that everything works correctly. My reason for using the PL/SQL is to generate a more dynamic output variable, based on elements of application throughout the entire application - and of course the use of shortcuts to minimize coding and duplication.
Thanks in advance,
BradHello
The body of the PL/SQL function must RETURN a value.
Try:
RETURN :APP_USER;
Andy
-
Chain replication using a sql function...
Hello
Is there a sql function that reproduces a string given so many times that appears in a parameter...?
For example: String-> test
Select < sql_function > ('test', 3) double
-> testtesttest
Note: I use Oracle10g v.2
Thank you
SIMWhat about a SQL?
satyaki> satyaki>select * from v$version; BANNER ---------------------------------------------------------------- Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod PL/SQL Release 10.2.0.3.0 - Production CORE 10.2.0.3.0 Production TNS for 32-bit Windows: Version 10.2.0.3.0 - Production NLSRTL Version 10.2.0.3.0 - Production Elapsed: 00:00:00.08 satyaki> satyaki> satyaki>select DBMS_XMLGEN.getxmltype ('SELECT '||chr(39)||'&str'||chr(39)||' cola FROM dual connect by rownum<='||&num).EXTRACT('//text()') res 2 from dual; Enter value for str: satyaki Enter value for num: 1 old 1: select DBMS_XMLGEN.getxmltype ('SELECT '||chr(39)||'&str'||chr(39)||' cola FROM dual connec new 1: select DBMS_XMLGEN.getxmltype ('SELECT '||chr(39)||'satyaki'||chr(39)||' cola FROM dual con RES ---------------------------------------------------------------------------------------------------- satyaki Elapsed: 00:00:00.07 satyaki>/ Enter value for str: satyaki Enter value for num: 2 old 1: select DBMS_XMLGEN.getxmltype ('SELECT '||chr(39)||'&str'||chr(39)||' cola FROM dual connec new 1: select DBMS_XMLGEN.getxmltype ('SELECT '||chr(39)||'satyaki'||chr(39)||' cola FROM dual con RES ---------------------------------------------------------------------------------------------------- satyakisatyaki Elapsed: 00:00:00.03 satyaki> satyaki>/ Enter value for str: satyaki Enter value for num: 3 old 1: select DBMS_XMLGEN.getxmltype ('SELECT '||chr(39)||'&str'||chr(39)||' cola FROM dual connec new 1: select DBMS_XMLGEN.getxmltype ('SELECT '||chr(39)||'satyaki'||chr(39)||' cola FROM dual con RES ---------------------------------------------------------------------------------------------------- satyakisatyakisatyaki Elapsed: 00:00:00.02 satyaki> satyaki>/ Enter value for str: satyaki Enter value for num: 5 old 1: select DBMS_XMLGEN.getxmltype ('SELECT '||chr(39)||'&str'||chr(39)||' cola FROM dual connec new 1: select DBMS_XMLGEN.getxmltype ('SELECT '||chr(39)||'satyaki'||chr(39)||' cola FROM dual con RES ---------------------------------------------------------------------------------------------------- satyakisatyakisatyakisatyakisatyaki Elapsed: 00:00:00.14
Kind regards.
LOULOU
Published by: Satyaki_De on September 27, 2008 14:10
-
ORA-06503: PL/SQL: function returned no value ORA-06512:
Hi all
SQL > set serveroutput on
SQL > CREATE OR replace FUNCTION qty_value (p_item_id number)
2 RETURN NUMBER
3 EAST
4 v_qty_arrival NUMBER;
5 BEGIN
6. SELECT THE CASE SENSITIVE OPTION
7. WHAT (SUM (b.quantity) - SUM (b.quantity_received)) < = 0 THEN 0
8 ELSE (SUM (b.quantity) - SUM (b.quantity_received))
9 END Qty_Arrival
10 INTO v_qty_arrival
Po_lines_all 11 a,
po_line_locations_all 12 b
13 WHERE a.po_line_id = b.po_line_id
14 AND a.item_id = p_item_id;
15 EXCEPTION
16 THEN THAN OTHERS THEN
17 v_qty_arrival: = NULL;
18 RETURN v_qty_arrival;
19 END qty_value;
20.
The function is created.
SQL >
SQL > select xxc_qty_arrivale (214960) double
2.
Select xxc_qty_arrivale (214960) double
*
ERROR on line 1:
ORA-06503: PL/SQL: function returned no value
ORA-06512: at the 'APPS '. XXC_QTY_ARRIVALE', line 19
Back AFTER using the exception block is fine as long as your code actually REACHED the exception block.
When there are no errors, then your code will not enter the exception block, but you still NEED to return a value, since it is what functions a function wants to return a value, that's what the functions are made for.
Spot the differences between the following 3 functions. Understand how they work.
The first function has only a return in the exception block but runs correctly. Result: error, because the back is missing in the code block.
The second function has a return in the exception block and one in the block of code and runs correctly. Result: no error, because the return is not missing in the code block.
The third function has a return in the exception block and one in the block of code and is forced into an error. Result: no error, because the return of the exception handler is used (instead of retriggering of the error, which you would normally do).
SQL > create or replace function myfunc
2 return number
3 as
4 start
5 dbms_output.put_line ('in the section of code');
6 null;
7 exception
8 then than others
9. can
10 dbms_output.put_line (' in the exception handler ' |) SQLERRM);
11 --
12 return 0;
13 --
14 end;
15.
The function is created.
SQL > select double myfunc;
Select double myfunc
*
ERROR on line 1:
ORA-06503: PL/SQL: function returned no value
ORA-06512: at "GHPLUS. MYFUNC", line 14
In the section of code
SQL > create or replace function myfunc
2 return number
3 as
4 start
5 dbms_output.put_line ('in the section of code');
6 null;
7 --
8 return 1;
9 --
10 exceptional
11 so that others
12. can
13 dbms_output.put_line (' in the exception handler ' |) SQLERRM);
14 --
15 return 0;
16 --
end 17;
18.
The function is created.
SQL > select double myfunc;
MYFUNC
----------
1
1 selected line.
In the section of code
SQL > create or replace function myfunc
2 return number
3 as
n number 4;
5. start
6 dbms_output.put_line ('in the section of code');
7 n: = 1/0; -force an error (zero divisor) to join the exception handler
8 --
9 return 1;
10-
exception 11
12 so that others
13. can
14 dbms_output.put_line (' in the exception handler ' |) SQLERRM);
15 --
16 return 0;
17 --
18 end;
19.
The function is created.
SQL > select double myfunc;
MYFUNC
----------
0
1 selected line.
In the section of code
In the handler for exception ORA-01476: divisor is equal to zero
SQL >
-
PL/SQL function to calculate the non-working days
Hello
I have the following pl/sql function which generates a number of days between two selected dates (i.e. excluding weekends). However, I also need to exclude specific holidays - day of Christmas etc. These holiday dates are stored in a table in our database (11 GR 2) called "HOLIDAY".
How can I integrate the holidays which is held in the table of holidays in the following query to exclude these dates as well? I know how to write a separate funtion pl/sql for a number of days between two dates using SELECT... BUT I can't work out how to bring together them in a single query.
Could someone show me how with the pl/sql / dates below please?
Example of HOLIDAY table below.
Thank you!
TP
create or replace function WORKING_DAYS (pi_start_date in date, pi_end_date in date) return integer is v_start_date date :=pi_start_date; v_end_date date:=pi_end_date; v_count integer:=0; begin while v_start_date <= v_end_date loop if to_char(v_start_date,'D') not in ('6','7') then v_count := v_count+1; end if; v_start_date:=v_start_date+1; end loop; return v_count; end;
(select '10-Apr-2013' as NWD from dual union all select '06-May-2013' from dual union all select '27-May-2013' from dual union all select '26-Aug-2013' from dual union all select '26-Dec-2013' from dual union all select '25-Dec-2013' from dual union all select '01-Jan-2014' from dual union all select '18-Apr-2014' from dual union all select '21-Apr-2014' from dual union all select '05-May-2014' from dual union all select '26-May-2014' from dual union all select '25-Aug-2014' from dual union all select '25-Dec-2014' from dual union all select '26-Dec-2014' from dual) HOLIDAYS
Hello
the link is on MOSC, not OTN... Here's a copy:
This function calculates the number of days between two dates, ignoring weekends and holidays (if requested and if the holidays are stored in a table)
I give an example of table 'public_holiday' with sample data, but users must ensure that their table contains the relevant data (all holidays within the maximum range of use of the service)
CREATE TABLE public_holiday (calendar_day, DATE, text VARCHAR2 (30));
FUNCTION to CREATE or REPLACE nb_days (p_date_from IN DATE
p_date_to DATE by DEFAULT TRUNC (sysdate)
, p_public_holidays in CHAR DEFAULT 'Y '.
) RETURN NUMBER
DEFINE AUTHID
AS
/*********************************************************************/
/ * Author: Bruno Vroman * /.
/ * Created: 23-AUG-2012 * /.
/ * Last updated: 23-AUG-2012 * /.
/ * Object: to calculate the number of days between 2 dates, to the exclusion of * /.
/ * Saturday and Sunday, but also "holidays" If the * /.
/ * argument 'p_public_holidays' = 'Y ' * /.
/ * Support: p_date_from<= p_date_to ="">=>
/ * component ' hour min dry "ignored (just counting days) * /.
/* First step: */
/ * the calendar days between 2 days * /.
/ Remove 2 days for each "week" and 0 or 1 extra day * /.
/ * function to a condition "complex" mix day of first week * /.
/ * and the number of days when full remaining weeks are removed * /.
/ * (set up once for all, for example if there is 3 days and the * /)
(/ * first day is a Thursday, there is 1 "Sat/Sun" to subtract) * /.
/ * Second step: If 'p_public_holidays' = 'Y': other * /.
/ * days, do not count holidays. */
/ Holiday everyday are defined in a table "public_holiday" * /.
/ * Note: there may be holidays defined on Saturday/Sunday. */
/*********************************************************************/
l_result NUMBER;
l_from DATE;
l_to DATE;
l_case tank (4);
BEGIN
l_from: = TRUNC (p_date_from);
l_to: = TRUNC (p_date_to);
l_case: = TO_CHAR (l_from, 'Dy', 'NLS_DATE_LANGUAGE = English').
To_char (MOD (l_to - l_from + 1, 7));
l_result: = l_to - l_from + 1
-TRUNC ((l_to-l_from + 1) / 7) * 2
-CASE
WHEN l_case IN ('Mon6', 'Tue5', 'Wed4', 'Thu3', 'Fri2'
, "Sat1", "Sun1", "Sun2', 'Sun3", "Sun4".
, "Sun5', 'Sun6.
)
THEN 1
WHEN l_case IN ('Tue6', 'Wed5', 'Wed6', 'Thu4', "Thu5"
, 'Thu6', 'Fri3', 'Fri4', 'Fri5', 'Fri6 '.
, "Sat2", "Sat3', 'Sat4', 'Sat5", "Sat6.
)
THEN 2
0 OTHERWISE
END
;
IF SUPERIOR (p_public_holidays) = "Y".
THEN
SELECT l_result - COUNT (*)
IN l_result
OF public_holiday p
WHERE p.calendar_day > = l_from
AND p.calendar_day<=>=>
AND SUBSTR (TO_CHAR (p.calendar_day
, "Dy".
'NLS_DATE_LANGUAGE = English'
)
, 1, 1 ) != 'S'
;
END IF;
RETURN l_result;
EXCEPTION
WHILE OTHERS
THEN
DBMS_OUTPUT. Put_line (' CTF nb_days (' |))
To_char (p_date_from, "MON-DD-YYYY"). ', ' ||
To_char (p_date_to, "MON-DD-YYYY"). ', ' ||
p_public_holidays | ' ) : ' || SQLERRM
);
LIFT;
END nb_days;
/
REM
REM example:
REM A) fill out the 'public_holidays '.
REM
TRUNCATE TABLE public_holiday;
INSERT INTO public_holiday VALUES (DATE ' 2012-01-01', ' new year (a Sunday)');
INSERT INTO public_holiday VALUES (DATE '' 2012-01-03, "for example");
REM (insert other days...)
COMMIT;
Call the function for some pairs of dates of REM B)
REM nb1: remove only Sat/Sun
REM nb2: also remove holidays
REM
ALTER SESSION SET nls_date_format ='Dy DD-MON-YY';
WITH some_dates AS
(SELECT DATE ' 2011-12-29'd dual FROM
UNION ALL SELECT DATE ' 2012-01-08' FROM dual
UNION ALL SELECT DATE ' 2012-01-10' FROM dual
)
SELECT d1.d 'FROM '.
, d2.d ' to THE '.
, nb_days (d1.d, d2.d, ' don't) nb1
, nb_days (d1.d, d2.d, 'Y') nb2
OF some_dates d1
some_dates d2
WHERE d1.d<=>=>
ORDER BY nb1, nb2, d1.d
;
GO TO NB1 NB2
------------- ------------- ---- ----
Monday, January 8, 12 Monday, January 8, 12 0 0
Friday, December 29, 11 Friday, December 29, 11 1 1
Wednesday, January 10, 12 Wednesday, January 10, 12 1 1
Monday, January 8, 12 Wednesday, January 10, 12 2 2
Friday, December 29, 11 Monday, January 8, 12 7 6
Friday, December 29, 11 Wednesday, January 10, 12 9 8
Hope that this could be useful, but note that this code has not been completely tested, so check and test before you trust it (in the case of any questions, please post a comment)
Bruno Vroman.
Best regards
Bruno
-
Hi all
I have a table which includes
ID, first_name, last name and date of birth
I want to retrieve all the records that have the same name and DOB
for example.
ID, first_name, last name, DOB
1 xyz abc 01/01/2012
hij 2 efg 15/05/2012
3 xyz abc 01/01/2012
4 xyz abc 01/01/2012
so in the output of 1, 3 and 4 rows will appear only.
can someone advise please on the appropriate SQL function
Thanks in advance
Hello
One way is to use the analytical COUNT function:
WITH got_num_rows AS
(
SELECT id, first_name, last_name, dob
, COUNT (*) OVER (PARTITION BY first name
last_name
, dob
) AS num_rows
FROM table_x
)
SELECT id, first_name, last_name, dob
OF got_num_rows
WHERE num_rows > 1
;
The subquery is needed here, because the analytical functions are calculated after the WHERE clause has been applied. To use the results of an anlytic function in a WHERE clause, you must calculate the function in a subquery, then you can use the results where you want (including the WHERE clause) of a Super query.
-
Examples of pl/sql code that can be used in training for new developers
Hello
I'm working on a training ride on the pl/sql to some developers who are totally new to PL/SQL. Although they are experienced in another language. I have power point on pl/sql presentations, but they especially the theory oriented with just a few examples. I'm looking for more help to have a few example pl/sql that can be given to interns as the code for example and also to practice. It should be a bit detailed and like to print the odd numbers or print "hellp world." Can anyone help to suggest if there is an example of code that is a bit detailed with a kind of complex problem which will give students a hands good example? I see a nice example at this link: http://tucano.tucanowebdesign.com/oracle/tutorial5.html - on an inventory system. It gives the feeling of being one on the issue of real-world work. So that if anyone knows of some other example say about 150 t0 300 lines or so of the code, I'll be grateful if it is shared.
Thank you
OrauserN
That said, I feel again (my perception) that more code a person writing/comments the better he gets. So, I want students to examine several code examples. I guess I need to see some books to bring out some really long piece of PL/SQL - like case studies.
. . .
But these guys are too busy and so I try to find the net / books some really detailed examples.But you seem to be overlooking that PL/SQL is supposed to be used for: PL means "procedural language.
So, PL/SQL must be used to 'procedure' treatment; This is typically several process steps. For example, when you want to run three applications as a "TRANSACTION". If all three completed successfully you COMMIT and if any of the three you don't ROLLBACK.
You can do this by using SQL only. And a developer doesn't have to write the code until they have a technical requirements doc that explains what problem the code is supposed to solve and the constraints and requirements that the code must implement.
So, my suggestion is the following:
1. identify and teach the types of issues that PL/SQL is used to help solve. Multi-step transactions, I mentioned above is an example
2. use the documentation and the code of your own organization in the form of samples. These 'guy' is perhaps too busy, but they should be able to provide to you all the documents for the code they wrote and that you use which would be good to use as examples. If they have no documents technical requirements so you just identify a MAJOR gap in the operations of your org that you must bring to the attention of management.
3. you can provide value added a lot more if you use code from your own org as a basis for what you are doing. A very useful training exercise is to ask students to perform 'code review' of a code (a procedure or function) and write simple comments, one line that explain, in plain English, what makes each piece of code.
4 comments, students create to step #3 can actually be incorporated into your code then existing so that future developers can use these comments to understand what the code actually does.
5 part of your 'education' should be on the way to 'test' correctly a piece of code PL/SQL to make sure it is doing what it is supposed to do. Again, if your students actually your own org code allows to create tests, these tests can then be added as a result of 'test' for this application and that adds value. A lot of times those developers 'busy' will not create the actual test cases and that your students can help remedy that. In addition, it does no good to know how to write PL/SQL code if you don't know how to test properly.
-
Hello
In a query XQuery is posssible to call a function or procedure SQL (PL / SQL)?
Here is an example of what I had accomplished:
SELECT THE PRD. XMLCOLUMN of
XMLTABLE (' for $i in ora: view("P_iXXX")/LINE)
$j in ora: view("P_jXXX")/LINE.
where
($i / NSU_xxx = $j/NSU_xxx)
return
(
< NCL >
{
$i / NSU_xxx,
H3. CALL the SQL function? as sql_xxx
for $k in ora: view("P_kxxx")/ROW
($vk/COD_RMP_VPM = "PRD")
Return()
}
< / NCL >
() "PATH of XMLType 'XMLCOLUMN' COLUMNS 'resultsqlfunction' INTEGER PATH 'xsql_xxx' INTEGER ACCESS to 'NSU_xxx' path 'NSU_xxx', '.') as the PRD;
Thanks in advance for your answers
FrançoisWho today replaces "ora: see?
On 11.2, ora expansion feature: view() is deprecated in favor of the fn:collection("oradb:/") method:
http://docs.Oracle.com/CD/E11882_01/AppDev.112/e23094/xdb_xquery.htm#BABECFFD
My DBA database have installed Oracle XML DB to use the XMLType and XMLTable, I thought that these features among other things speed up the creation of XML.
What are the benefits of using XQuery and XMLTable and XMLQUERY functions?
Which version of the database you use?
Please read: http://docs.oracle.com/cd/E11882_01/appdev.112/e23094/xdb_xquery.htm#CBAGCBGJ
Is there another method to expedite the creation of XML?
Publication of SQL/XML functions are probably the best way to create custom relational data XML documents.
The basic functionality of XQuery is not to the RDBMS query tables or views, although Oracle provides extensions to do.
Most of the time, I use XQuery (via XMLTable and XMLQuery) to do exactly the opposite, i.e. to extract XML data in a relational form, or the transformation of XML fragments.If your actual requests are slow - even if you need to define what that means and that you are pregnant - then maybe the SQL/XML functions are not the real problem.
In a "Where clause" as I turn, I have several "outer join". Here is an example.
where
PPM. NSU_PPM = w.NSU_PPM and FRNS. NSU_FRN (+) IS FCO. NSU_FRN and FCO. NSU_FCO (+) IS PPM. NSU_FCO
and T2O. NSQ_T2O (+) IS PPM. NSQ_T2O
and T51. NSQ_T51 (+) IS PPM. NSQ_T51
and TWU. NSU_STT (+) IS PPM. NSU_STT
and T01. NSQ_T01 (+) IS PPM. NSQ_T01
and vpm.cod_rmp_vpm (+) = "PRA".
and vpm.num_vsn_vpm (+) = PPM.vsn_sup
and w.nsu_ppm = A.nsu_ppm (+)
and W.NSU_SOO = A_HEADER. NSU_SOO and A_HEADER. NOR_SOM = 0Yes, it's exactly what I was talking about.
Transposing the logic for XQuery 1.0 is not the approach more simple (to say the least), because there is no direct support OUTER JOIN.
XQuery 3.0 provides the functionality, but it is not yet here in the database.My suggestion would be to stick to the publication of SQL/XML functions.
If you have a specific question about the performance, we (as the members of the forum) will be happy to help you.
Provides the steps necessary to reproduce the problem, including some examples of data.Kind regards
Marc.
-
No support for oracle sql functions
Hi all
Please can someone explain why the B-tree indexes are not capable of supporting SQL queries using the built-in functions of Oracle.
We have indexes of tree b on account_no column.
Select * from test_table where account_no = 11005208
the above query use the index on account_no
Select * from test_table where superior (account_no) = 11005208
But this query does not use the index on the account_no, going for the full table scan.
My question here is account_no is the numeric data type.
Then, there is no difference between the data in the columns account_no and upper (account_no) column data, so why he does not use index when using sql functions in an sql query?Hello
If you apply the upper function, Oracle implicitly converts its argument to a string, so your query is actually upper (to_char (account_no)).
There is none HAVE fully functional in the optimizer and you do not expect to know everything and do all the conclusions that a human being can do. Why should Oracle re - write this type of query analysis the data type of the columns and features when it seems more natural programmer write a correct query (without capital letters in this example) or, if necessary, create an index based on a function? -
Block PL/SQL function call
Hello
A very simple question.
A have a function called "test1" in my database. This is where, I double undercover.
I want to call this function from a block:
DECLARE
BEGIN
TEST1 (1202);
END;
It gives me an error.
Why is this?Hello
user610868 wrote:
OK, but why is - this?For example:
Current_Row v_real_data % ROWTYPE;
SELECT * IN current_row r v_real_data where are.id_key = key;
I expect this to leave empty current_row rather than raise an error.
This is how it works inside a function.
Otherwise, it triggers NO_DATA_FOUND. If you find that inconsistent, then you have company, but of the tht like that.T.PD wrote:
in PL/SQL, you need to assign the return value of the function to a variable (or pass it as a parameter to a som other PL/SQL code).Or use it as an operand, for example:
IF test1 (1202) > 0 THEN ...
The point is you need to do something with the value. A value in itself is not a valid statement of PL/SQL.
Maybe you are looking for
-
Could I get a free replacement for the phone that was diagnosed with the liquid damage clause?
Hello It's Vincent of the India. My iPhone 5 exploded randomly while I was listening to music, about 2 weeks back. Don't turn on since. The inspection service center claimed to have found traces of liquids on "residents" of the device and thus were c
-
I've just updated my software and have lost software and icon of scans!What to do to restore it?
-
Where can I find the Stock Rom / Firmware for tab 3 7 "essential TB3-710F?
I'm looking for the Stock of the TB3-710F LenovoPad Rom.
-
HP inkjet color cp 1700d - Windows Vista
Hello, does anyone know where I can get a good drivers for hp inkjet cp 1700d color? Windows vista drivers, are not good! Thank you
-
Hello I use professional Vista as the operating system of my laptop. Recently - specifically, since having started using COMCAST (cable TELEVISION) - provided internet service - I started having a condition of starting Windows in which Windows Defen