How to display all parent regions (repeatedly reference cursor)?
CREATE TABLE regions
PARENT_NAME VARCHAR2(30),
CHILD_NAME VARCHAR2(30)
INSERT INTO regions VALUES(NULL,'Asia');
INSERT INTO regions VALUES(NULL,'Australia');
INSERT INTO regions VALUES(NULL,'Europe');
INSERT INTO regions VALUES(NULL,'North America');
INSERT INTO regions VALUES('Asia','China');
INSERT INTO regions VALUES('Asia','Japan');
INSERT INTO regions VALUES('Australia','New South Wales');
INSERT INTO regions VALUES('New South Wales','Sydney');
INSERT INTO regions VALUES('Canada','Ontario');
INSERT INTO regions VALUES('China','Beijing');
INSERT INTO regions VALUES('England','London');
INSERT INTO regions VALUES('Europe','United Kingdom');
INSERT INTO regions VALUES('Illinois','Aurora');
INSERT INTO regions VALUES('Illinois','Chicago');
INSERT INTO regions VALUES('Illinois','Rockford');
INSERT INTO regions VALUES('Japan','Osaka');
INSERT INTO regions VALUES('Japan','Tokyo');
INSERT INTO regions VALUES('North America','Canada');
INSERT INTO regions VALUES('North America','United States');
INSERT INTO regions VALUES('Ontario','Ottawa');
INSERT INTO regions VALUES('Ontario','Toronto');
INSERT INTO regions VALUES('United States','Colorado');
INSERT INTO regions VALUES('United States','Illinois');
INSERT INTO regions VALUES('United States','Texas');
INSERT INTO regions VALUES('United Kingdom','England');
COMMIT;
Based on the REGIONS table, write a PL/SQL anonymous block that accepts a region name from the user input and display all its parent regions.
right now this is what I have so far:
ACCEPT p_1 PROMPT 'Please enter the region name: '
DECLARE
v_rname regions.child_name%type := '&p_1';
v_count number;
v_counter number := 0;
v_parent regions.parent_name%type;
v_child regions.child_name%type;
cursor reg_cur is
select parent_name, child_name from regions;
BEGIN
open reg_cur;
fetch reg_cur into v_parent, v_child;
select count(*) into v_count
from regions
where upper(child_name) = upper(v_rname);
if v_count = 0 then
dbms_output.put_line(v_rname || ' is not in the regions table.');
else
while reg_cur%found loop
if upper(v_rname) = upper(v_child) then
if v_parent is null then
v_parent := v_child;
dbms_output.put_line(v_count || ') ' || upper(v_parent));
else
dbms_output.put_line(v_count || ') ' || rpad(upper(v_rname), 20) || '<<<<<' || lpad(upper(v_parent), 10));
end if;
end if;
fetch reg_cur into v_parent, v_child;
end loop;
end if;
close reg_cur;
END;
if user inputs 'chicago' my query returns only a single parent. I'm not certain how to keep referencing the cursor so that I could output the rest of the parent_names and child_names until parent becomes null
the output should be:
chicago <<<<< illinois
illinois <<<<< united states
united states <<<<< North america
Hi,
If you have to do this in PL/SQL, then why don't you use Solomon's solution in PL/SQL?
BEGIN
FOR regions_info IN
select child_name || ' <<<<< ' || parent_name AS txt
from regions
where parent_name is not null
start with child_name = '&p_1'
connect by child_name = prior parent_name
LOOP
dbms_output.put_line (regions_info.txt);
END LOOP;
END;
/However, if you want to see what's happening with your code, add some code to make sure you don't get into an infinite loop. I used the local variable v_counter (which you had declared, but not used for anything else) to count how many times you had gone through the loop, and EXIT once you reach 100 times.
Also, add some more calls to dbms_output, so you can see what's going on.
For example:
else
v_counter := 0;
loop
v_counter := v_counter + 1;
EXIT WHEN v_counter > 100;
dbms_output.put_line ( v_child || ' = v_child, '
|| v_parent || ' = v_parent in LOOP'
open reg_cur;
fetch reg_cur into v_child, v_parent;
if upper(v_rname) = upper(v_child) then
dbms_output.put_line(v_counter + 1 || ') ' || rpad(upper(v_child), 20) || '<<<<<' || lpad(upper(v_parent), 10));
end if;
fetch reg_cur into v_child, v_parent;
close reg_cur;
v_parent := v_child;
exit when v_parent is null;
end loop;
...Make sure you issue the SQL*Plus command
SET SERVEROUTPUT ONbefore running this; otherwise, you won't see the output from put_line.
What do you see?
Do you understand why you're in an infinite loop?
Do you really want the cursor to do exactly the same thing every time you call it?
Maybe you should add a parameter to the cursor, which can be used in, say, a WHERE clause.
Edited by: Frank Kulash on Feb 2, 2011 11:50 PM
Similar Messages
-
How to display all the surveys using content query web part
Can you please tell me how to display all the surveys using content query web part in more details? I also created a subsite and multiple surveys in that site. Then, I inserted a Content Query Web Part and select the List Type to be "Survey",
however, it returned nothing. Did I miss anything?Hi,
OOTB Survey List does not contain any
Content Types and it has the following structure:
Response entry is represented by
List Item
Response entry consist of questions and answers, where Question correspond to
Field and Answer to Item value respectively.
For querying Survey List via CQWP the following properties could be used
BaseType
<Lists BaseType="4">
ServerTemplate
<Lists ServerTemplate="102">
Example
To retrieve all the responses from Survey lists, specify List Type property as shown on picture
Reference:
http://stackoverflow.com/questions/17280778/display-all-surveys-using-content-query-web-part
Best Regards,
Eric
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected] -
How to display All User Logged in time & Logout Time?
How to display All User Logged in time & Logout Time?
Hi..
I want to display All user who logged in the portal,
their username,
their time logged in,
their time logged out..
where can i find these information?
do Portal have already something like this?
Plz advise..Thanks.The login information is in the wwlog_activity_log. The logout action is only logged when it is explicit. I am using the last user action time for the logout time so I can determine the duration of the visit.
-
How to display all tables residing in my database
i'm using 10g express edition.
i'm developing a .net application using oracle
i want display table infomation in a datagrid
for that i need to select tables fromthe database using the interface given by them
in that i found server name field.....what it actually means?
also how to create a new database in 10g and how to display all tables residing in the database?
pls help me
thanking u
chaitanyauser11359516 wrote:
i want display table infomation in a datagrid
select owner||'.'||table_name owner_table_name
from all_tables
user11359516 wrote:in that i found server name field.....what it actually means?i'm not sute what you mean by server name field? if you refer to table column name see this code below:
select owner||'.'||table_name||'.'||column_name table_column_name,
decode(data_type,'VARCHAR',data_type||'('||to_char(data_length)||')',
'VARCHAR2',data_type||'('||to_char(data_length)||')',
'NUMBER',decode(data_scale,0,data_type||'('||to_char(data_precision)||')',
null,data_type,
data_type||'('||to_char(data_precision)||','||to_char(data_scale)||')'),
data_type) type,
nullable
from all_tab_cols
order by table_name, column_id -
How To Display All Comments for a Planning Package
Hi,
I have the How-to guide mentioned in the subject and have now moved onto BI7. Is the guide still applicable in BI7 and how would I go about implementing the above How-to in IP instead of BPS?
Thanks,
AleThanks Marc.
I will use BW-BPS for the time being as I've seen screenshots of the solution in the how-to. Still need to answer the question here:
How To. Display All Comments for a Planning Package
As I have no idea how to achieve the functionality detailed in the thread above.
Thanks for your time Marc,
Regards,
Ale -
How to display all the questions of a survey in a page?
How to create multiple surveys in a survey list?How to display all the questions in a page and provide feedback button for each question?While giving the feedback user can ab. to see posted question date and posted person name.
sinduHi,
To display all the questions in a page instead of in a dialog, you can achieve it by using such an URL:
http://yoursite/Lists/survey1/NewForm.aspx?IsDlg=0
You can add a hyperlink with this URL into a page of your site, then you can navigate to the questions page by clicking this hyperlink.
About how to add a hyperlink into a page:
http://sharepoint.stackexchange.com/questions/55543/how-to-add-a-hyperlink-anchor-in-a-sharepoint-wiki-page
If you have several questions to ask, it is recommended to post them into every single thread to make others easier to focus on one question in one thread.
Feel free to reply if there is still any questions.
Best regards,
Patrick
Patrick Liang
TechNet Community Support -
NOT WORKING -How To Display All Comments for a Planning Package
Hi All,
I am using How to Document "How To Display All Comments for a Planning Package" to display comments for list of "cost center" against different "fiscal/year" for Key Figure "Budget Amount".
Below is how the Layout looks like where comments are posted against Cost Center- year combination.
Cost Center 2007 2008 2009 2010 2011
3 2.00 2.00 2.00 2.00 2.00
4 2.00 2.00 2.00 2.00 2.00
6 2.00 2.00 2.00 2.00 2.00
7 2.00 2.00 2.00 2.00 2.00
This case is very similar to the example given in how to document but after following all the steps correctly in the document and also followings various forum links such as below , I am not able to display the comments for list of Cost Centers.
"How to...BSP display comments"...problem with row comment
Below are the issues being faced:
1) When i save the comments , the icon for comments (indicating that some comments have been entered) is not shown against selection of Cost Center-Year although the comment is saved.Comment are also visible in BPS0.
2) On execution "Web interface could not be loaded" - is the message that is shown in the area where BPS application should show all the comments.
Highly Appreciate any help with issues mentioned above.
Kind Regards,
Robin JohriHello Robin,
1) please check if you set the row/cell selection property correctly for the layout component in the web interface.
2) the error does not make sense since the comments are displayed in an iframe using a BSP application, not a web interface. Check the URL in the HTML text component.
Regards,
Marc
SAP Techology RIG -
Hierarchical query - How to get all parent records - Duplicate post
Hi,
In Oracle, START WITH, CONNECT BY commands will give all the direct and indirect child records. Other way round, is they are command which gives all the parent records till the root? Please let me know. I am working on Oracle 9i Release 2.
Thanks a lot for your help.
Edited by: skv on Nov 21, 2008 11:05 AMDuplicate post.
Hierarchical query - How to get all parent records
Please edit this post heading to duplicate post.
Regards.
Satyaki De. -
How to display all the under menus options when pressing the main menu on adobe muse?
How to display all the under menus options when pressing the main menu on adobe muse?
How to display all the under menus options when pressing the main menu on adobe muse?
-
How to display the dynamic region in full size
Hi,
I'm not able to display the dynamic region in full size.
In my page, i attached a dynamic region which refers a page fragment. This dynamic region contents are showing as small (scroll is there but i want to display fully).
How to do this?
Thanks in advance,
SundarMore than likely it has something to do with your parent layout element. I'd suggest putting your region in an af:panelStretchLayout or similar container that stretches its children. Some of the elements can be a little tricky though, such as af:panelTabbed. It has an attribute that must be set to stretch its first child.
-
How to display "All Items" using a "Filtered Rows" Combo Box
Hi
How do I make a Combo Box with "Filtered Rows" show "All Values" by default, AND have the option to select individual filters?
If my data was
North
South
East
West
I would want the Combo box to display
ALL
North
South
East
West
When the user selected:
North, they should see just the filtered rows with North
South, they should see just the filtered rows with South
ALL should be the default, and it should ifilter/include North, Soutn, East and West (i.e. showing all the rows)
I need to use a Combo box and Filtered Rows, because I actually want to filter my dataset using multiple columns:
Company, Region, District, Sector, Value
My current method is to:
use a Combo to filter the RawData on Company into an Intermediate_Company worksheet
use another Combo to filter the Intermediate_Company worksheet on Region into an Intermediate_Region worksheet
use another Combo to filter the Intermediate_Region worksheet on District into an Intermediate_District worksheet
use another Combo to filter the Intermediate_District worksheet on Sector into an Intermediate_Sector worksheet
then display in a List View from the Intermediate_Sector worksheet.
Any comments on this method would also be welcome.
Thanks for your help
StuartThanks Muwa
I've uploaded a non-working version here: http://www.teradepot.com/ntxgoo6629zi/Simple_All_Combo.xlf.html
I've figured out how to use tthe filter to copy a subset of the rows in the source date to the destination are of the worksheet.
I can't figure out how to use a filter to copy ALL the rows in the source to the destination.
I've seen hints about using hidden filters, but I can't make this work, either. It's quite depressing, really
I'm very grateful for any help you can give.
Thanks in advance
Stuart -
How to display all value of metadata from nodes collection model in content presenter template
Hi All,
first of all the new look of OTN is great.
coming to problem i am facing (i dont know whr to ask here or in portal forum).
i am creating a content presenter template to display list of items.
now as per requirement i need to create a drop down to filter the list.
now while check- in a file author would choose a value in one metadata field lets say xCategory(which is a single select list).
i have to display similar category list on portal to allow user to filter list.
i could hv used view of xCategory but problem is files are targeted to role using ACL. so u see i cant display all category to all users.
also customer wants this whole thing to be Dynamic i.e. they can add value of xCategory later that to could be only for specific role (on portal it should be role specific , author can see whole list not a problem there).
so what i think is if content is given as search result so the category. so now if i can get the all xCategory metedata from 'nodes' collection model in template i can create drop down with out having any additional bean.
somthing like this
#{nodes.xCategory} (but this one is not correct).
please suggest me any solution.
thanks
-someshHi,
you can do all of what you said with JSF. ADF Faces provides drag and drop functionality (have a look at the Web Developer Guide) that allow you to move nodes within a tree. The drag and drop framework sends an event notification to the server with a reference to the changed node.You can also have context menus on a tree node to help users creating, deleting and editing a tree nodes. JavaScript isn't required at all, even if you wanted to drag and drop a row in a table on top of a tree node to create a new tree node.
I just finished a book project in which we explained this usecase. As soon as I find the time, I'll follow up with a blog entry on this as it seems to be a common requirement. However, as mentioned, the web developer guide on OTN explains drag and drop in ADF Faces pretty well.
However, if you choose the "Search" link above, choose JDeveloper and ADF as the product to search for and type drag and drop as the search string, then you get lots of code sample posted in the past to this forum
Frank -
How to display all data on one page in web app
Hello.
So I have web app JSF (IceFaces framework) + JBoss all Crystal Report working perfectly. So I have page with Crystal Report tags (e.g.
<bocrv:reportPageViewer reportSource="#{crystalReport.reportPath}" ...
in this report I have table with some data (data from DB) and I want to display this data on one page. Unfortunately now this data are moving to the next page and unfortunately I even donu2019t know how switch to the next page (I see only info e.g. 1with 2).
So how to display this data on one page if its impossible how to torn on pagination.So I canu2019t do this, I canu2019t display all data on one page (until Iu2019m using JSF tags)?
In JSF tags Iu2019m setting only path to file. In my bean Iu2019m using u201CReportClientDocumentu201D object itu2019s easy way to load report file (u201Copenu201D method) and set parameters (u201CgetDataDefController().getParameterFieldController()u201D method) and also connect to data base (u201Clogonu201D method) but I havenu2019t this property u201CsetSeparatePages(boolean)u201D.
Maybe Iu2019m doing this wrong and there is a simpler way maybe I can use somehow u201CCrystalReportVieweru201D please give my any advice. -
How to display all rows in the report in one page in Oracle APEX 3.2
Friends -
We are using Oracle Applications Express 3.2 on oracle database 10.2.0.5 on solaris environment.
One of our report contains total no of rows 50000. when we ran report by default it is showing 15 and i can go search and change display no of rows to different numbers and click go.
My question is it possible to display all 50000 rows during first time report launching without going to change rows. Is there any option that we can set how many number of rows that we can display during report design.
Please advise
VSHHello VSH,
>> My question is it possible to display all 50000 rows during first time report launching without going to change rows
As vee pointed out it is possible, however the question you need to ask yourself is is it wise?
Bear in mind that displaying 50,000 rows on a single HTML page means a lot of code that must be loaded by the client browser all at once. What it will do to your page loading time? Browser memory? Network bandwidth? Also, do you really believe that it is effective to let an end user look for a specific row among 50,000 rows?
Regards,
Arie.
♦ Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.
♦ Author of Oracle Application Express 3.2 – The Essentials and More -
How to display all tagged photos from the whole catalogue?
Hi,
I have been googleling around, but have not found the right information. I am trying to find all my tagged photos of all imported photos, but it would only show the tagged photos from a specific folder when I select that specific folder or from the timeline, in which I already knew that some tagged photos belong in those folders.
My question is...how can I search tagged photos from the whole catalogue without going through the timeline or clicking each folder and subfolder to view them. I would like that the organizer display all tagged items from all my folders and subfolders at once.
Sorry if this has been answered and I was not able to find the right forum or information.
Many thanks in advance!
DreamyThanks a lot!
Maybe you are looking for
-
I have a early 2008 Macbook Pro, need to up grade the hard drive so that I can add a windows environment what is the largest drive that I can put in this computer? Is the storage size the constraint or the physical size of the drive? Or a combination
-
Dear All, Our users need to share the work list for PO Approval workflow with others in the dept. but if the user other than the one who was the initial recipient of the notification approves the PO; the workflow approval history still shows the orig
-
Grouping of Shopping Carts using the report BBP_SC_TRANSFER_GROUPED
Hi Experts, I am a new SRM consultant and have been asked to investigate an issue regarding grouping of Shopping Carts using the report BBP_SC_TRANSFER_GROUPED. The wanted scenario: For one specific vendor we wish to pool/group request coming from v
-
My iPad appears in iTunes but it is greyed out.
my iPad appears in itunes but it is greyed out and then iTunes times it out. I know iTunes is working because my iPod syncs no problems. Can anyone help. I have deleted iTunes and re-installed and I have turned my iPad on and off while pluggedin.
-
Bind variable does not exist after processFormRequest
Hello. I recieve the following stacktrace after doing a forward page immediately: pageContext.forwardImmediately("CAOADownload.jsp?transactionid=" + pageContext.getTransactionId() + "&retainAM=N", null, OAWebBeanConstants.KEEP_MENU_CONTEXT, null, nul