Using a procedure in the clause FROM a query
Is it possible to use a procedure which accepts several parameters and returns several parameters in the FROM of a query section?I have a procedure that puts a format BS7666 address in a friendly format Oracle Apps.
I would like to be able to select the data from the source to feed through this procedure and output as part of a materialized view.
PROCEDURE Format_llpg_Address
(
In_Loc IN VARCHAR2,
In_Description IN VARCHAR2,
In_County IN VARCHAR2,
In_Town IN VARCHAR2,
In_PostTown IN VARCHAR2,
In_Saon_Start_num NUMBER,
In_Saon_Start_Suffix IN VARCHAR2,
In_Saon_End_num NUMBER,
In_Saon_End_Suffix IN VARCHAR2,
In_Saon_Text IN VARCHAR2,
In_Paon_Start_num NUMBER,
In_Paon_Start_Suffix IN VARCHAR2,
In_Paon_End_num NUMBER,
In_Paon_End_Suffix IN VARCHAR2,
In_Paon_Text IN VARCHAR2,
In_PostCode IN VARCHAR2,
Out_Address1 OUT NOCOPY VARCHAR2,
Out_Address2 OUT NOCOPY VARCHAR2,
Out_Address3 OUT NOCOPY VARCHAR2,
Out_Town OUT NOCOPY VARCHAR2,
Out_County OUT NOCOPY VARCHAR2,
Out_PostCode OUT NOCOPY VARCHAR2)
Thank you very much
Jason.
You should look at [pipelined functions | http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28370/tuning.htm#i52954]
Adrian Billington has a number of excellent articles on the pipeline functions.
Here's a [link to one of them | http://www.oracle-developer.net/display.php?id=207]
Published by: dombrooks on October 12, 2009 16:45
Tags: Database
Similar Questions
-
How to use an index with the clause 'in '.
Hi all
I have a sql statement with "" * in the clause * "."
for example:
select emp_id from emp where ename in ("vikas", "krishna", "John", "scott");
When I check the plan explain he uses the index here even if the statistics was entered. He always goes for the full table scan.
There is an index created for the ename column.
Please tell me a technique on how to make use of the index here.
Thank you and best regards,
Vikas KrishnaVikas,
What version of Oracle you are running.
CLAUSE IN will use the index as appropriate.
In your example Optimizer may decide to use FTS (Full Tablle Scan) for various reasons. May be that the table is very small.
SE for example below where he uses an index on the CLAUSE IN...
The essential point being that I made "wide enough" table (in this case including a column of type CHAR) makes use of INDEX more effective than a FTS.select * from v$version where rownum < 2; Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi create table bigt (c int, s char(100)); insert into bigt select level, 'X' from dual connect by level < 501; create index bigt_in1 on bigt (c ); exec dbms_stats.GATHER_TABLE_STATS('SUDHAKAR', 'BIGT'); explain plan for select c,s from bigt where c in (1,2,3,43,5); select * from table(dbms_xplan.display); PLAN_TABLE_OUTPUT Plan hash value: 238667275 ----------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ----------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 5 | 520 | 3 (0)| 00:00:01 | | 1 | INLIST ITERATOR | | | | | | | 2 | TABLE ACCESS BY INDEX ROWID| BIGT | 5 | 520 | 3 (0)| 00:00:01 | |* 3 | INDEX RANGE SCAN | BIGT_IN1 | 5 | | 2 (0)| 00:00:01 | ----------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 3 - access("C"=1 OR "C"=2 OR "C"=3 OR "C"=5 OR "C"=43)
VR,
Sudhakar B. -
How to display the records from a query in the non-base data field
Hello
I have a problem:
I have a query with a lot of tables and column 6 (select a, b, c, d, e, f x, y, z, t, s, g where the conditions) and I use 3 parameters.
I create 3 settings: datai,: dataf and: partner and a button with a trigger when the button is pressed.
Then a create a block manually with six field non-database a1, b1, c1, d1, e1, f1.
Now, I want to display all the records in my query in a1, b1, c1, d1, e1, f1 where a1 = a, b1 = b, etc. and all the records (if I have 20 record, it will display 20 records in the non-base data field) when I press the button.
How I did it:
I create a cursor with the query, and then
start the open cursor
loop
Fetch cursor in: a1,: b1,: c1: d1: e1,: f1;
end loop;
close the cursor;
end;
It displays a single record in a1, b1, c1 only, and it must display 100 records and date for all fields.
Can someone help me with this problem?
Thank you.
Published by: 928437 on October 1, 2012 02:55Creating a view and the query in a database block are a great solution.
To use the block non-base of data:
You are missing the most important Next_Record; command.Begin
Go_block('X'); -- block X is the non-database block
Clear_Block(No_Validate);
open cursor X1;
loop
If :System.Record_status != 'NEW' then
Next_Record;
End if;
fetch X1 into :a1,:b1,:c1,:d1,:e1,:f1;
Exit when X1%NOTFOUND;
end loop;
close X1;
end; -
When I click on an e-mail link in a page, it comes up with a box asking if I want to use gmail or outlook, which I did not? I did not have this problem on my other computer. I need to know, in Firefox, how to change this option to use my e-mail account of Qwest. Not sure I'm explaining properly. Thank you
The mailto: protocol automatically asks you what you want to use when you click mailto: links. Default value for me on Ubuntu is Thunderbird.
You can't exactly use your e-mail address for the to do directly from Firefox (Firefox is not a messaging application), but you really need to sign in to your account of Qwest and copy / paste the e-mail address of the recipient.
Another thing to do is to synchronize your mail from Qwest for Thunderbird, then when you want to use mailto:, you can choose Thunderbird with ease.
-
Create the stored procedure with the table from another throw diagram PLS-00201
Oracle 10g. I'm new on procedures, so maybe I'm missing something obvious.
The ABC schema owner has table T2001_WRITEOFF. The SYSDBAs given SIUD Some_Update_Role and granted this role to developer user IJK. IJK user then created a private synonym T2001_WRITEOFF for ABC. T2001_WRITEOFF. It worked with the usual SQL DML commands.
When I try to create a simple procedure, it throws PLS-00201 identifier "T2001_WRITEOFF" must be declared and the points of the 2nd line.
create or replace procedure woof1(
fooname in T2001_WRITEOFF.territory%TYPE, <=== error points here
bardesc IN T2001_WRITEOFF.ind_batch_submit%TYPE) IS
BEGIN
INSERT into T2001_WRITEOFF
VALUES ( fooname, bardesc);
END woof1;
/What I am doing wrong?
Thank you
JimR
Grant the necessary rights directly to the user (not through a role):
http://asktom.Oracle.com/pls/asktom/asktom.download_file?p_file=6551289900368934430
-
Placing values retuened to a cursor at the place where the clause of a query SELECT
Hello
I'm trying to accomplish a task of writing a SELECT statement where I have to query the table based on the values returned by a cursor.
For example:
SELECT a.operator_name, a.country_name, a.state_name FROM Table_A a WHERE a.country_id IN (values returned by cursor for country ID) AND the a.operator_name in (values returned by cursor for Operator_Id) AND a.state_id in (values returned by cursor State_ID for).
Is it possible to make this request, my task is to write it in a stored procedure so that I can return a cursor reference with values as described above.
Please let me know how to go about this request.
PS: Cursors are used because it is a Wild-Card search for values where several records can be returned.
Thanks in advance.
Kind regards
PriyaBecause your
SELECT a.operator_name, a.country_name, a.state_name FROM Table_A a WHERE a.country_id IN (Values returned from cursor for Country ID's) AND a.operator_name IN (Values returned from Cursor for Operator_Id's) AND a.state_id IN (Values returned from Cursor for State_ID's)
say something like (sliders deliberately avoided (see Tom Kyte mantra - http://asktom.oracle.com/pls/apex/f?p=100:11:0:::P11_QUESTION_ID:73891904732164))
SELECT operator_name,country_name,state_name FROM Table_A WHERE country_id IN (select country_id from countries where upper(country_name) like 'U%? ) AND operator_name IN (select operator_id from operators where operator_name like 'A%' ) AND state_id IN (select state_id from states where state_name like 'C%' )
Concerning
Etbin
-
between the clause of sql query?
Hi all
After sql query using a report.
------------------------------------------------
Select trunc (m.spc_doc_date) prod_date, sum (nvl(d.req_qty,0)) order_qty, sum (nvl(d.spc_item_qty,0)) prod_qty
of spc_ppc_daily_m m, spc_ppc_daily_d d
where m.spc_doc_ # in (select spc_doc_ # to spc_ppc_daily_m)
- and d.blce_qty > 0
and m.spc_locn_code =: locn_code
and m.spc_doc_date between: TO_date and: FROM_date
and m.spc_locn_code = d.spc_locn_code
and m.spc_doc_ #= d.spc_doc_ #.
and (m.obu =: obu OR: OLGA IS NULL)
and (m.customer =: customer OR: CUSTOMER IS NULL)
Trunc Group (m.spc_doc_date)
order of trunc (m.spc_doc_date)
-----------------------------------------
"When I use to_date = 22 February 2012 ' from_date = February 22, 2012"
There is no pick up. (acually documents are there on February 22, 2012)
"When I use to_date = 22 February 2012 ' from_date = February 23, 2012"
now shows data of February 22, 2012.
I have replace between it of > = & < =, same result two cases respectively.
Why?
Thank you
Yoanndate you hours minutes and seconds
thenuse
trunc (m.spc_doc_date)or to: from_date in the parameter after form convert to February 23, 2012 23:59:59 '
-
OK to use a cffunction in the output of a query?
Is it OK to pass a parameter to a cffunction, execute a select query, then finally the result?
Can someone show me how to call the function and the result of the query of exit?
< cffunction name = returntype "func_getCats" = "query" >
< cfargument name = "department" >
< cfset = var getCat "" / >
< name cfquery = "getCat" datasource = #APPLICATION.datasource # >
SELECT category
OF the test
Department WHERE = #arguments.department #.
< / cfquery >
< cfreturn getCat / >
< / cffunction >
I say I don't think that the particular syntax is permitted. You will probably need to enter the results in a variable. Then use the name of the variable in your cfoutput.
(pretend that this code snippet with tags)
CFSET func_getCats() = result
cfoutput query = 'result '.
#category #.
/cfoutput
-
Divide the result from a query
Hello
I want to split/Group (I'm not sure about terms) a result of the query. Suppose I get a query with 50 results. I would like to show only 4 then the next 4 etc.. I have the following code that displays arrows active and inactive.
I imagine the create a loop around my results of the 4 games and place each of these sets in a DIV. Images of related arrow would then show hide resp. the DIVs.
The code below, I've prepared this day but I can't continue because can not resolve the above question and then find an effective idea of showing each result set.
Someone has a good entry? It would be great!
Thank you very muchHere is the solution to my problem:
http://www.Adobe.com/cfusion/webforums/Forum/MessageView.cfm?CATID=3&ThreadId=1402501 -
In the mapping of an interface using ODI procedure
Hello
Yesterday, I asked question how will you use ODI procedure in the mappings of an interface for complex operations on the fields?
I don't know if this can be done in ODI.
Any help on this would be helpful.
Kind regards
Mahesh
Don't forget the basic principle of procedure and function.
Now coming to your question, first of all to a large no second thing its an impractical and immature question to ask someone to use the ODI procedure in the mappings of an interface for complex operations on the fields. (Or maybe issue was something and you wrote something. Too bad)
The main reason for the ODI process must allow group of actions that do not fit within the Interface and considered that when something can be achieved with the interface. She's. I always encourage to turn against the interviewer in such circumstances.
What should have been the question is if we can use the DB procedure in the interface mapping. Answer is that it depends. I can use the phases of analysis to write some java-based codes to call a db procedure. But this isn't for my fields from the source to the complex functioning and codes based on java will be isolated from each other.
For a complex operation, you use a function that can be called without flaw inside the DML and DQL statements. Inside the function, you can use as many procedure to do the massage/validation/transformation.
Chantal
-
Problem with the Entity Framework by using stored procedures
I am developing a project with Oracle DB and Entity Framework.
Due to performance issues, for some querys I uses procedures stored instead of LINQ queryies,
When I try to add my model EF procedure, the procedure is added but the Model Designer
It does not acknowledge the columns returned by the procedure.
so I can't create something complex to the user the results of the procedure
in a domain serviceHere's the relevant readme which has some tips: http://www.oracle.com/technetwork/topics/dotnet/tech-info/default-338300.html#mozTocId610465
If you do a forum search there is further discussion of the issues, and the readme file provided with version beta has also some information.
But I agree with the general theme: using stored procedures in the EF is a PITA. :( I really hope they do something to make it easier in the future because this is probably the single most important weakness in the implementation of Oracle EF and establishment of a complex type is your time and picky it's ridiculous. (I found it less problematic if your procedure returns a complete picture that your model has already an entity for, because you can get away with only add the entry to one of the configurations for the cursor rather than one for each column.)
Even an external tool where direct you to the procedure and it creates the configuration entries to be able to copy and paste would be a huge improvement.
-
HOWTO save PDF generated (using BEEP) directly in the custom as BLOB table?
Hello
I'm working on APEX on the Oracle DB 12 c version 5.0.1 (Oracle database, 12 c Enterprise Edition Release 12.1.0.2.0 - 64 bit)
We have an application which was initially founded in APEX 4.1, but migrated to 5 APEX.
Now, we want to add features.
In a report from the region (classic report), one of the columns is an image of the print icon that on click starts a JS function.
Basically, this generates a PDF using BI Publisher in the background.
Query of the region:
Select ' < a href = "#" onclick = "javascript:f_PrintReport('||)." dcl.ID |') ; "> < img src =" "#IMAGE_PREFIX #print02.gif ' alt = 'Print' > < / a > ' Print"
of my_custom_table;
The page level (header HTML) JS
< script language = "JavaScript" type = "text/javascript" >
<!--
function f_PrintReport (declaratie_id)
{
get var = new htmldb_Get (null, $v ('pFlowId'), 'APPLICATION_PROCESS is SET_REPORT_PARAMETER', $v ('pFlowStepId'));
get.addParam('x01',declaratie_id);
gReturn = get.get ();
get = null;
check the dest to run the correct report
Run the report
document. Location.href = ' f? p = & APP_ID.:0 : & SESSION. : PRINT_REPORT = VAT STATEMENT ';
}
->
< /script >
It's using queries report and presentations in the shared components. It all works well.
But after generation, we now want to save the PDF generated as a BLOB in a custom table.
I am looking how I can "capture" this output to be stored directly in the DB.
Some advice there?
Thank you!
Roeland
Hello
I use different how to cope:
I read the report of APEX_UTIL. GET_PRINT_DOCUMENT to the variable of BLOB.
After that I just create target resp file.
I use this just after APEX_UTIL. GET_PRINT_DOCUMENT that opens the browser download link.
part of the code example:
In your case use just insert in the table instead of the file from the Bank on the file system.
v_filename_xls := v_filename||'.xls'; -- crate the PDF file to external dir l_document := APEX_UTIL.GET_PRINT_DOCUMENT ( p_application_id => :APP_ID, p_report_query_name => 'report_ins', p_report_layout_name => 'report_ins', p_report_layout_type => 'rtf', p_document_format => 'xls'); -- l_blob_len := DBMS_LOB.getlength(l_document); -- if not utl_file.is_open(f_data_init) then dbg_pk.trc(2,'create file for write.'); f_data_init := utl_file.fopen(v_if_dir, v_filename_xls, 'W', 32767); end if; -- -- Read chunks of the BLOB and write them to the file -- until complete. WHILE l_pos < l_blob_len LOOP DBMS_LOB.read(l_document, l_amount, l_pos, l_buffer); UTL_FILE.put_raw(f_data_init, l_buffer, TRUE); l_pos := l_pos + l_amount; END LOOP; -- Close the file. UTL_FILE.fclose(f_data_init);
concerning
J
-
How to disable "signed with the certificate from the certificate store.
Adobe Reader v11.0.10, opens in trial mode.
«You use features (sign with the certificate from the certificate store), which require a license with more features (Expert).»
The program will continue, but your document will show that it was made in demo mode.
Under the document keyword properties I see ' "MODE of TRIAL / Expert features: sign with the certificate from the certificate store" "
I uninstalled and reinstalled Adobe Reader do not understand how to return to original and free characteristics.
So the question is, how do I disable the functions that require a license?
I have found the source of the problem and and embarrassed to say he wasn't Adobe Reader. The problem was in the program I used to create a PDF document (he used a cert to sign the document) which was then opening Adobe Reader.
Please consider this issue resolved.
Thank you
R.
-
Report of ColdFusion using stored procedures
I have isntalled report 10 ColdFusion and connected to the RDS Server.
I just saw tables and views, but not stored procedures.
I would like to know it is possible to use stored procedures for the report data source.
Your information and help is much appreciated,
Kind regards
Iccsi,
Thank you fo rhelping and informaiton.
I found that it supports the stored procedures,
Kind regards
iccsi
-
Hello!
I m facing a problem with the help of oraext: query-database.
In my transformation im try the following (Simplified):
How to get the correct value when you use oraext:query - database?<xsl:template match="*"> <xsl:variable sqlQuery="select ....."/> <xsl:variable name="storeSec" select="oraext:query-database($sqlQuery,true(),true(),'jdbc/xref')/> <xsl:choose> <xsl:when test="string-length($storeSec/ROWSET/ROW[1]/STORE_PART_SECTION) > 0"> <xsl:value-of select="$storeSec/ROWSET/ROW[1]/STORE_PART_SECTION"/> </xsl:when> <xsl:otherwise> <xsl:value-of select"some other val"/> </xsl:otherwise> </xsl:choose> </xsl:template> {code} This always results in +some+ +other+ +val+ !! I´v checked the output from oraext:query-database by using getcontentAsString and if I instead test putting the expected output from oraext:queryDatabase in my variable it gives me A100 which is what i expected. {code} <xsl:template match="*"> <xsl:variable sqlQuery=select ....."/> <xsl:variable name="storeSec"> <ROWSET> <ROW num="1"> <STORE_PART_SECTION>A100</STORE_PART_SECTION> </ROW> <ROW num="2"> <STORE_PART_SECTION>XXm</STORE_PART_SECTION> </ROW> </ROWSET> </xsl:variable> <xsl:choose> <xsl:when test="string-length($storeSec/ROWSET/ROW[1]/STORE_PART_SECTION) > 0"> <xsl:value-of select="$storeSec/ROWSET/ROW[1]/STORE_PART_SECTION"/> </xsl:when> <xsl:otherwise> <xsl:value-of select"some other val"/> </xsl:otherwise> </xsl:choose> </xsl:template>
How should you exit? Several item ID with each having a value of the result set?
If Yes, then you can try following:
Maybe you are looking for
-
I did a lot of smart folders, but they seem to have disappeared, what to do?
I did a lot of smart folders, but they seem to have disappeared, what to do?
-
Any warranty in Croatia need registration number
Hello!I need assistance with the registration nmwg. I broke the screen of my laptop. When went to the service, they told me that they need to record number, but I accidentally deleted while cleaning up my Inbox and now I can't get it back. Y at - it
-
I have a problem with the connection of the speakers.
Original title: speakers... Speakers were disconnected from the back of the computer, and I know not where/how plug them back in, and the speaker in the taskbar icon has a red x on it with this message 'the device does not appear to be connected' whe
-
Error codeService Pack 2 (KB 921896) what to do? Lasse 2B 22, could not install update: Microsoft SQL Server 2005 Express Edition
-
Why Microsoft doesn't let me close my hotmail account?
I followed all the links to close my Hotmail account. I don't have billing with Hotmail services. I have not all accounts Microsoft Points. I want to delete the account. How can I do this? You should know that I already followed the procedure from "c