Proc to dbms_output contents of a query
Hi All,
I am currently working on a test case - logging module. I need to write a procedure where we can pass a SQL SELECT QUERY as a parameter. Procedure should display the data returned by QUERY in key(value) format for each column.
I was currently doing it by writing a loop for each query. But I wish to write a generic procedure.
Please help me and guide me.
Thanks in Advance
Nimish Garg
See sample code in Re: How to execute a proc and spool files in a database job
The important bit is DO NOT PASS A SQL QUERY STRING!
This is almost always wrong. Two major issues:
SQL injection
bind variables
Both these are addressed by the caller creating a ref cursor using the SQL (doing proper variable binding), and the passing the ref cursor handle to the API/library package.
This can then convert the ref cursor handle into a DBMS_SQL cursor handle number, and use the DBMS_SQL interface to determine and process the SQL projection of that cursor.
Similar Messages
-
Dbms_output.put_line in this query
I want to put a dbms_output.put_line in this query so it will give my the property_id is checking first in the PM_EXCHANGE_PROPERTY_PRIORITY
(its part of a more bigger procedure)
dbms_output.put_line('RESORT ID one=> '||rci_dep_rec.resort_id);
with
base_prop as (
select /*+ MATERIALIZE */ property_id, priority
from PM_EXCHANGE_PROPERTY_PRIORITY ppp
where ppp.exchange_affiliation = 'RCI'
and ppp.master_property_id in (select ppp2.master_property_id
from P_PM_PROPERTY ppp1, PM_EXCHANGE_PROPERTY_PRIORITY ppp2
where ppp1.rci_id_number = rci_dep_rec.resort_id
and ppp1.property_active = 'Y'
and ppp1.exchange_affiliation = ppp.exchange_affiliation
and ppp2.property_id = ppp1.property_id)
union
select property_id, 99999
from P_PM_PROPERTY ppp
where ppp.rci_id_number = rci_dep_rec.resort_id
and ppp.property_active = 'Y'
and not exists (select 1 from PM_EXCHANGE_PROPERTY_PRIORITY ppp1 where ppp1.property_id = ppp.property_id)
order by 2
select pput.pm_unit_type_id
bulk collect into pm_unit_type_ids
from P_PM_UNIT_TYPE pput, S_PM_EXCHANGE_MAPPING spem, base_prop bp
where spem.exchange_affiliation = 'RCI'
and spem.resortcode = rci_dep_rec.resort_id
and ((spem.unitnumber = rci_dep_rec.unit_no and rci_dep_rec.resv_type = 'WEEKS')
or (spem.unitnumber = rci_dep_rec.unit_type and rci_dep_rec.resv_type = 'POINTS'))
and rci_dep_rec.start_dt between spem.begin_date and spem.end_date
and pput.property_id = spem.property_id
and pput.pm_unit_type_active = 'Y'
and instr(spem.unittypecode, pput.pm_unit_type) > 0
and spem.property_id = bp.property_id
ORDER BY bp.priority,pput.pm_unit_type_priority;
end;
dbms_output.put_line('RESORT ID => '||rci_dep_rec.resort_id);
but im not sure where i can put ii, i have it to give my the resort_id
i want to know which one the property_id is checking first, there is only two , one has a higher priority
for example if i hardcoded it
select /*+ MATERIALIZE */ property_id, priority
from PM_EXCHANGE_PROPERTY_PRIORITY ppp
where ppp.exchange_affiliation = 'EZY'
and ppp.master_property_id in (select ppp2.master_property_id
from P_PM_PROPERTY ppp1, PM_EXCHANGE_PROPERTY_PRIORITY ppp2
where ppp1.rci_id_number = '8789'
and ppp1.property_active = 'Y'
and ppp1.exchange_affiliation = 'RCI,II'
and ppp2.property_id = 'VDG')
union
select property_id, 99999
from P_PM_PROPERTY ppp
where ppp.rci_id_number ='8789'
and ppp.property_active = 'Y'
and not exists (select 1 from PM_EXCHANGE_PROPERTY_PRIORITY ppp1 where ppp1.property_id = 'VDG')
order by 2
i would get this
PROPERTY_ID|PRIORITY
VDR |1
VDG |2
thanks for help or tipsHi Nat,
Your question is not very clear (other wise you would have an answer from this forum by now).
What you are showing is an SQL (which is part of bigger picture). Bigger picture is important. Is it a PL/SQL procedure or function?
DBMS_OUTPUT.PUTLINE is a procedures call, that can be called in PL/SQL. What you have shown us is a SQL from within the PL/SQL.
Please do NOT paste a larger piece of code.
The place where you ave shown the DBMSOUTPUT.PUT_LINE seems correct.
However,
You said
but im not sure where i can put ii, i have it to give my the resort_id
i want to know which one the property_id is checking first, there is only two , one has a higher priority
The sequence in which rows are processed does NOT matter in SQL and there is no such thing as "checking first". ALL the rows that satisfy the criteria. Since you have ORDER BY the rows will be returned in that order.
Please explain what problem you are trying to solve.
Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved, so that the people who want to help you can re-create the problem and test their ideas.
Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
Always say which version of Oracle you're using (for example, 11.2.0.2.0).
See the forum FAQ: https://forums.oracle.com/message/9362002
Hope this helps.
vr,
Sudhakar -
Content Tracker Reports Query file modification issue - Custom Report
Hi All,
I was trying to generate a custom report using Content Tracker. I was successful in doing so. However, I found that sometimes it does not pick up the updated query file of Content Tracker reports.
I made a change in my query:
from SELECT * FROM Users to
SELECT dname FROM Users
the change is written on the file but when i generated the report from C.T. UI, it's still showing me the old results having all the columns. Tried bouncing the server as well, but no use.
I also added a new query 24 hrs back (as SELECT count(*) As UsersNum FROM Users), it's still not recognizing it and giving error as Failure of server APACHE bridge: No backend server available for
connection: timed out after 10 seconds or idempotent set to OFF;
and the log says,
Unable to execute service SCT_GET_DOCUMENT_INFO_ADMIN and function sctExecuteQuery.
Unable to create the result set for query '(null)'. SQL statement to execute cannot be empty or null
What could be the resolution of this issue?
I am using UCM 11g + SSXA.Server bounce.
Issue is not file update but some other issue, ongoing in another thread by Me. -
TX - row lock contention in SELECT query without update clause
Hi,
We are having problem in one of our application on production. The ASH report shows 'eq: Tx row lock contention' for only Select statements. There is no FOR UPDATE in the select statements. The exact statement is
enq: TX - row lock contention : SELECT COUNT (1) FROM Table1 WHERE col1= :1 AND col2= :1 AND col3= :1 AND ROWNUM = 1
enq: TX - row lock contention : SELECT MODULE_CD , MSG_DESC , SEVERITY FROM GS_ERROR_MSG WHERE MSG_NUM = :1
I don't know why the select are locking the table rows and resulting in waits..
Our environment is Oracle 10g and Forms & Reports..
Please help.
-- PrashantHi,
are you sure that there is no dml against the tables?
You can query v$active_session_history (eg column BLOCKING_SESSION) to see which session locked the row.
HTH..
- wiZ -
Technical Content Cube 0TCT_MC21, Query 0TCT_MC21_Q0111
Hi SAP experts
We have a problem:
Executing the query 0TCT_MC21_Q0111 for runtime processes seems to ignore some relevant infopackages with high runtime.
Have you ever experienced such symptom with content statistics in 7.0?
The subsequent respectivley the following DTP is listed in the DTP-statistics. Isn't this very strange?
Any ideas?
Regards
ChäsitzerDear Lokesh
Thanks for your rapid reply.
This note solves our problem.
Thanks
Chäsitzer -
POST http(s) request with xml content in Power Query
I have a POST http request which works good in HttpRequester (Firefox plugin). I know that it is possible to call POST request in Power Query but cannot find working solution. Here is the original request:
POST https://svcs.ebay.com/FeedbackService
X-EBAY-SOA-OPERATION-NAME: createDSRSummaryByPeriod
X-EBAY-SOA-SERVICE-VERSION: 1.0.0
X-EBAY-SOA-SERVICE-NAME: FeedbackService
X-EBAY-SOA-APP-NAME: ***
X-EBAY-SOA-SITEID: 0
X-EBAY-SOA-SECURITY-TOKEN: ***
Content-Type: text/xml
<?xml version="1.0" encoding="UTF-8"?>
<createDSRSummaryByPeriodRequest xmlns="http://www.ebay.com/marketplace/services">
<dateRange>
<dateFrom>2013-12-01T00:00:00.000Z</dateFrom>
<dateTo>2013-12-31T23:59:59.999Z</dateTo>
</dateRange>
<dateRangeEventType>ListingDate</dateRangeEventType>
</createDSRSummaryByPeriodRequest>
Power Query WebContent() function is capable to handle headers and xml content, however, there is no any documentation about its syntax.
In Power Query I use this request:
= Xml.Tables(Web.Contents(“https://svcs.ebay.com/FeedbackService”,
[Headers =[" X-EBAY-SOA-OPERATION-NAME"= "createDSRSummaryByPeriod",
"X-EBAY-SOA-SERVICE-VERSION="1.0.0",
"X-EBAY-SOA-SERVICE-NAME"="FeedbackService",
"X-EBAY-SOA-APP-NAME"="***","X-EBAY-SOA-SITEID"="0",
"X-EBAY-SOA-SECURITY-TOKEN"="***"],
Content=["<?xml version="1.0" encoding="UTF-8"?>
<createDSRSummaryByPeriodRequest xmlns="http://www.ebay.com/marketplace/services">
<dateRange>
<dateFrom>2013-12-01T00:00:00.000Z</dateFrom>
<dateTo>2013-12-31T23:59:59.999Z</dateTo>
</dateRange>
<dateRangeEventType>ListingDate</dateRangeEventType>
</createDSRSummaryByPeriodRequest>"]]))
However, it returns "Expression.SyntaxError: Invalid identifier." Maybe anyone has at least examples of analogous working syntax?Task is solved. First of all I updated PowerQuery since previous version does not support Headers option for Web.Contents function. Here is a correct syntax:
=Xml.Document(Web.Contents("https://api.ebay.com/ws/api.dll",[Headers=[#"X-EBAY-API-COMPATIBILITY-LEVEL"= "871",#"X-EBAY-API-SITEID"="0",#"X-EBAY-API-CALL-NAME"="GetMyeBaySelling",#"CONTENT-TYPE"="text/xml"], Content=Text.ToBinary("<?xml version="&Character.FromNumber(34)&"1.0"&Character.FromNumber(34)&" encoding="&Character.FromNumber(34)&"utf-8"&Character.FromNumber(34)&"?>
<GetMyeBaySellingRequest xmlns="&Character.FromNumber(34)&"urn:ebay:apis:eBLBaseComponents"&Character.FromNumber(34)&">
<RequesterCredentials><eBayAuthToken>***</eBayAuthToken></RequesterCredentials><SoldList><DurationInDays>60</DurationInDays><Pagination><EntriesPerPage>100</EntriesPerPage><PageNumber>1</PageNumber></Pagination></SoldList></GetMyeBaySellingRequest>")])) -
How to reterive content using dynamic query through content repository
Hello,
i am reteriving content from content repository,using following tag:
<pz:contentQuery query="PPF_Type='Forms' && SupportGroup='HR'" sortBy="cm_modifiedDate" max="5" id="HRForms"/>
where SupportGroup='HR/IT/Finance'
How can I get property value dynamically without hardcoding like above,instead i want it as follows:
String formQuery="PPF_Type='" + typeName + "' && SupportGroup='" + groupName + "'";
How can i get 'typeName' and 'groupName' as variable through jpf,if i have to display titles in same page.Hello,
i am reteriving content from content repository,using following tag:
<pz:contentQuery query="PPF_Type='Forms' && SupportGroup='HR'" sortBy="cm_modifiedDate" max="5" id="HRForms"/>
where SupportGroup='HR/IT/Finance'
How can I get property value dynamically without hardcoding like above,instead i want it as follows:
String formQuery="PPF_Type='" + typeName + "' && SupportGroup='" + groupName + "'";
How can i get 'typeName' and 'groupName' as variable through jpf,if i have to display titles in same page. -
Content Presenter CMIS Query. Cache
Hi!.
Is it possible caching CMIS Queries in Content Presenter TaskFlows of WebCenter Portal PS3?
Thanks :).
Edited by: Daniel Merchán on 03-nov-2011 17:03Have a look at this post: http://yonaweb.be/webcenter_tutorial/using_content_presenter_templates
And search for the "Building the List page" section. This shows how to use a query in the content presenter from within JDev.
The query needs to be CMIS which you can find more information about in this post: http://yonaweb.be/using_cmis_query_content_query_navigation_model -
Content Search Webpart Query (urltoken to list metadata column)
Im developing a internet site using Cross site publishing.
In the publishing site collection, on a category page, Im trying to query the relevant contents
on a catalog list using urltoken to metadata column on a list using Content search webpart.
I have created list of departments in the metadata and same is used as part of managed navigation.
Metadata term : New department
friendly url : New-department
When I query the Catalog's metadata column (department column) using the urltoken.1 (new-department) it is not fetching the results
since the value is New department (space between two words)
Any help on how to query correctly.Hi Ramamor,
Thanks for posting your issue, Kindly browse below mentioned URLs to configure the query in a content search web part for content Metadata step by step
http://blogs.technet.com/b/tothesharepoint/archive/2013/03/07/stage-5-connect-your-publishing-site-to-a-catalog.aspx
http://blogs.technet.com/b/tothesharepoint/archive/2013/05/23/stage-10-configure-the-query-in-a-content-search-web-part-on-a-catalog-item-page.aspx
http://sp2013.blogspot.in/2012/08/content-search-and-metadata-driven.html
I hope this is helpful to you, mark it as Helpful.
If this works, Please mark it as Answered.
Regards,
Dharmendra Singh (MCPD-EA | MCTS)
Blog : http://sharepoint-community.net/profile/DharmendraSingh -
Hi ,
I am to trying to add a property filter to a content search webpart.I have to query the property with the page title of the current page.So assuming my page url ends with "/Pages/b1.aspx".I want to query by b1. I see that there is "value of
a token from url" option available in the drop down but I cannot make out how I can parse out the page title("b1" in the example).
Thanks in advance,Hi ,
When you select Value of a token from URL, the query text will add {URLToken.1} by default. {URLToken.1} represents a value from the URL of the current page. The integer, in this case
1, represents the value in the URL as counted from right to left. So, for example, the current page URL where the content search web part is added in : http://www.contoso.com/SitePages/Home.aspx, the query variable {URLToken.1} represents the value Home.aspx.
For query variable {URLToken.2}, it represents the value SitePages .
This means only if the current page where the content search web part is added in is bi.aspx, you can add {URLToken.1} and filter all results whose URL contains bi.aspx in the last.
For achieving your demand, you can create a new content source with the URLs you want .
http://technet.microsoft.com/en-us/library/jj219808(v=office.15).aspx
Best Regards,
Eric
Eric Tao
TechNet Community Support -
Content search webpart query is not rendering result as per the expectation !!
Hello,
I have 5 Content search web part on same page with different display templates.
1) Search Aggregated Result - This display search results for announcements,discussion and wiki as per the current user.
2) My websites - Thsi displays site links as per the current user.
3) My Tasks - This display task items as per the current user
4) Daily calendar - This display the results as per the date selection in calendar control.
For Daily calendar - I have specified calendar control in custom display template to filter search results based on date selection which is working as below:
I have got the reference from following link that changing the query dynamically to filter search result data -
http://sharepointificate.blogspot.in/2014/08/content-search-webpart-dynamic-filtering.html
ctx.OnPostRender = [];
ctx.OnPostRender.push(ctx,function(){
$('<div id="trCalendar" class=""></div>').insertBefore('#idCalender')
$(document).ready(function () {
$("#trCalendar").datepicker( {
onSelect: function(date) {
var groups = Srch.ScriptApplicationManager.get_current().queryGroups;
$.each(groups, function () {
// Look for query groups associated with a CSWP
if (this.displays != null && this.displays.length > 0) {
if (this.displays[0] instanceof Srch.Result) {
// Update and execute query
var newQuery = 'ContentTypeId:0x0102*'+ ' ' +'EndDate'+ '>=' + date;
this.dataProvider.set_queryTemplate(newQuery);
this.dataProvider.issueQuery();
selectWeek: true,
However, this date query is being applied for every search result web part mentioned in page.
How can I make it work only for the Daily Calendar web part ?
Your answer will be much appreciated.
Thanks and Regards,
Dipti ChhatrapatiDipti,
How about replacing you line as below (with content class)
var newQuery = 'ContentTypeId:0x0102*'+ ' ' +'EndDate'+ '>=' + date;
with
var newQuery = 'contentclass:STS_ListItem_Events'+ ' ' +'EndDate'+ '>=' + date;
Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply. -
Content conversion File Query.
Hii,
I wanted a little help with the content conversion. I have mentioned the parameters bleow:
Document Name: MT_Vault_TRY
RecordStructure: DT_DLY_DEPOSIT1.*
Key Field Name: DT_DLY_DEPOSIT1.STRNBR
parameters:
DT_DLY_DEPOSIT1.fieldNames STRNBR,SLSDT,RECTYP,TNDRTYP,CURRTYPCD,AMT
DT_DLY_DEPOSIT1.fieldSeparator ','
DT_DLY_DEPOSIT1.endSeparator 'nl'
ignoreRecordSetName true
My Record structure looks like:
MT_VAULT_TRY
-DT_DLY_DEPOSIT1
--STRNBR
SLSDT
RECTYP
TNDRTYP
CURRTYPCD
AMT
The Problem faced here is that the flat file does not get picked from the ftp directory.When the same file is defined as an xml w.o the content conversion, it gets processed. Thus the commu.channel details are fine.
The transfer mode is 'text' and my file name is "dly.txt."
Could somebody please help me out on this one.
Thanks~HD,
If you have given your RecordStructure as DT_DLY_DEPOSIT1.* then it is wrong. You should give like this:
<b>DT_DLY_DEPOSIT1,*</b>
Also in Key field name you give as STRNBR
In the parameters you give like this:
ignoreRecordSetName true
DT_DLY_DEPOSIT1.fieldNames STRNBR,SLSDT,RECTYP,TNDRTYP,CURRTYPCD,AMT
DT_DLY_DEPOSIT1.fieldSeparator ,
DT_DLY_DEPOSIT1.endSeparator 'nl'
Also if you have only one strucutre DT_DLY_DEPOSIT1 then you dont need keyfield also.
So you have to change fieldseparator as <b>,</b> instead of <b>','</b> and <b>remove keyfield</b> and give a try.
---Satish -
How to sort the content of a query
HI guys,
I need to know how can i short the result of a query.
Here is my code.
DATA qs TYPE REF TO cl_crm_bol_dquery_service.
DATA qr TYPE REF TO if_bol_entity_col.
qr ?= qs->get_query_result( ).
i have seen that on the if_bol_entity_con there's a method but it's not implemented.
Do i have to implement it.
Thanks
Jonhi,
Please, use markup to explain your source
after, try just to call the method
qr->IF_BOL_BO_COL~SORT(...)
Rgds -
File Content Conversion related query
Hi Experts,
Hope you all are doing well.
I have a proxy to File scenario in which a File containing HR data has to be created.
The source structure is as follows
Header -
1..1
Recordset 0..unbounded
Master------0..unbounded
Detail----
0..unbounded
Content-----0..unbounded
<End of Recordset>
Trailer-------1..1
The File to be created has to be of type Fixed Length. The structures 'Header', 'Master', 'Detail','Content' and 'Trailer' contain numerous fields each.
The output file should have the following structure:
Header
Master
Detail
Content
Master
Detail
Content
Master
Detail
Content
Master
Detail
Content
Trailer
Can you please let me know how to handle the scenario using FCC?
regards
DebansuMartin,
Thanks a lot. Your suggestion actually solved the issue.
Ravi,
I had checked Shacarish's blog. Actually, we do not require the additional java mapping. FCC is able to take care of the issue.
Java mapping might be required for deeper structures. But thanks a lot for the suggestion.
regards
Debansu -
Erase all content and settings query
Hi All
I manage a corporate mobile account for our business. I recently upgraded one of my users from a 4S to a new iPhone, he was not technically minded so I walked him through backing up the old phone and set-up the new phone from the back-up. I had to do this via iTunes as his iCloud was locked out (he'd changed his AppleID and the phone hadn't replicated through). We got the new phone up and running and the user went away happy.
Ordinarily I'd wipe the old phone and redeploy it elsewhere in the business but this one won't let me erase it without removing Find my iPhone and of course I can't because iCloud's greyed out. I've subsequently seen the fix for this in the forums - return the AppleID to it's original name then log back in and remove the iCloud, alternatively log into iCloud and remove the old device from his list of devices.
Unfortunately I don't have access to the user to follow this process - is there no other way to wipe the phone?
I understand the concern about privately owned devices falling into the wrong hands and being wiped and sold etc and the need to ensure that an individuals personal data on a corporate device can be returned to them (we have mobile device management software that allows us to wipe the corporate data on the phone if lost or stolen).
I can prove that the device belongs to the company and that the user's account is active on the new phone. My guess is the phone is bricked unless I can get access to the user and walk them through reverting their AppleID but would be pleasantly surprised if there is a quick fix.
Kind regards
SWelcome to the Apple Community.
Unfortunately you need the password to remove the account, only the account holder can access these details.
Maybe you are looking for
-
Unable to print to pdf after adobe update
Hi All, After an adobe acrobat last week, I am unable to print word documents as pdf. I get the following error message: Invalid "ADOBE PDF" printer properties: Do not change spooler settings. Please select "Print directly to the printer" option (fro
-
In both of the RAD environment which I have previously used, there are property editors for a collection of a particular property type. In Borland's VCL the property editor is built-in once one uses a VCL collection as a property, while in .Net one c
-
How to use Adobe Anywhere in a small business environment.
Thanks in advance for any help. Our marketing agency has a small 1000 sq ft video studio with a couple fully loaded 27" iMac's with additional thunderbolt displays and a Pegasus 2 16TB Raid thunderbolt drive. I collaborate with remote editors every
-
HAP_DOCUMENT in new window
Hi Everyone, we're currently using ess/mss together with the BSP application HAP_DOCUMENT. We have a requirement from the users where they want the window that displays the document to be a separate window. The BSP application is integrated into the
-
Add custom fields to Pipeline Performance Management (PPM)
Hi experts, I have to add new custom (z-)fields from Opportunity (crmd_opport_h) to Pipeline Performance Management. Component PPM_OPPLIST, View OppListView. How can I do that. I haven't found any Information about that yet. Can anybody help me and d