Advertisement

03.04.2008 at 02:18PM PST, ID: 23214261
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.6

How to create a View from a PL/SQL procedure (Oracle 9i)

Asked by GNOVAK in PL / SQL, Oracle 9.x

Tags:

We are using oracle 9i. Although I've programmed for 20+ years in VB, VBA, C, etc. I am new to Oracle.
I wish to run a report off of a view.  I would rather not create a table to generate the report off of, since we will be using whatever method we come up with quite a bit in the future.  Creation of many tables may get out of hand in a hurry. In other languages, I would create something on the fly and then clean up after myself - very little overhead.   I'm trying to do the same with PL/SQL.

I'm using Access as the report/user interface and have had no problems as long as the views are static.  I am able to pass and retrieve paramters between Oracle and Access.
The view I need to use uses two tables. It is static except for one area where I need to filter one of the tables by a passed company name (i.e. "WHERE ..... AND COMPANY='COMPANY1' AND....)

I have tried using EXECUTE IMMEDIATE and it errors, but I can't tell what the error is. I looked at the resultant str (see code) and it looks fine.  
Is there a way to create a view on the fly?

Or, what other methodology might be suggested.


Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
str := 'CREATE OR REPLACE VIEW MY_ANALYSIS(source_id, COUNT_TRANSACTIONS, LN, PRODUCT_NO, SUM_COST, SUM_RETAIL, PERC_DISC)';
  str := str || ' AS SELECT   a.source_id, COUNT (a.source_id) AS COUNT_TRANSACTIONS, A.LN, a.PRODUCT_NO, SUM(A.COST) AS SUM_COST,';
  str := str || ' SUM(A.PRICE) AS SUM_RETAIL, to_char((B.PERC_DISC *100),' || CHR(39)||'999.999'|| CHR(39)||') AS PERC_DISC FROM MYFILE1 a,'; 
  str := str || ' MYFILE2 b WHERE a.MY_FLAG =' ||CHR(39) ||'Y' || CHR(39);
  str := str || ' A.PRODUCT_NO = B.PRODUCT_NO AND B.COMPANY =' ||CHR(39) ;
  str := str ||'COMPANY1'||CHR(39);
  str := str ||' GROUP BY a.source_id, A.LN, A.PRODUCT_NO,B.PERC_DISC';
  str := str ||' ORDER BY A.LN DESC, A.PRODUCT_NO ASC;'    ;
   EXECUTE IMMEDIATE str;
 
Loading Advertisement...
 
[+][-]03.04.2008 at 03:10PM PST, ID: 21046116

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PL / SQL, Oracle 9.x
Tags: PL/SQL
Sign Up Now!
Solution Provided By: SmilingPixie
Participating Experts: 3
Solution Grade: A
 
 
[+][-]03.04.2008 at 10:48PM PST, ID: 21048250

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.05.2008 at 02:13AM PST, ID: 21049030

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.05.2008 at 06:31AM PST, ID: 21050552

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.05.2008 at 06:56AM PST, ID: 21050789

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.05.2008 at 07:33AM PST, ID: 21051150

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.05.2008 at 09:45AM PST, ID: 21052547

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.05.2008 at 12:06PM PST, ID: 21053933

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.05.2008 at 02:24PM PST, ID: 21055282

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.05.2008 at 02:29PM PST, ID: 21055324

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.05.2008 at 08:19PM PST, ID: 21057294

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]03.06.2008 at 12:46AM PST, ID: 21058392

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.06.2008 at 09:09AM PST, ID: 21062420

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-44 / EE_QW_2_20070628