passing multiple values from the query in the select statement of the procedure
I am collecting IDS to select education agreement from the date of rental values and then I would pass the result of the query in the statement select to get the result.data type for the contract id is of type varchar and date of rental there is more than one id to contract for most of the time. Help, please. Thank you
CREATE OR REPLACE PROCEDURE abstract_menu (p_letting IN VARCHAR2,
p_results OUT SYS_REFCURSOR)
IS
v_contractId VARCHAR2 (40);
SELECT lcontid
INTO v_contractId
FROM letprop
WHERE datestat IS NOT NULL AND letting = p_letting AND letstat <> 'R';
BEGIN
OPEN p_results FOR
SELECT DISTINCT
SUBSTR (l.letting, 3, 2)
|| '-'
|| SUBSTR (l.letting, 5, 2)
|| '-'
|| SUBSTR (l.letting, 1, 2)
lettingdate,
l.lcontid contractid,
SUBSTR (q.cprojnum, 1, 10) projectnumber,
DECODE (TRIM (MIN (j.route)), NULL, 'N/A', TRIM (MIN (j.route)))
routenumber,
L.DATESTAT statusdate,
L.LETSTAT lettingstatus,
(q.cdescr) jobdescription,
INITCAP (q.clocat1 || q.clocat2) LOCATION
FROM vendor v,
vendaddr r,
letprop l,
planhold p,
proposal q,
project j,
propproj k,
bidlet bd
WHERE v.vendor = r.vendor
AND k.contid = q.contid
AND k.pcn = j.pcn
AND l.lcontid = k.contid
AND p.vendor = v.vendor
AND l.letting = p.letting
AND l.lcontid IN v_contactid "**************This is where I would like to pass the contract id from the above select statement***********'"
AND l.CALL = p.CALL
AND r.addrnum = p.billto
AND bd.letting = l.letting
GROUP BY q.cdescr,
q.clocat1,
q.clocat2,
bd.letting,
l.letting,
l.lcontid,
q.cprojnum,
L.LETSTAT,
L.DATESTAT
ORDER BY lettingdate;
end;
user9196150 wrote:
AND l.lcontid IN v_contactid ' * this is where I would like to pass the id of the select statement above contract * ""»
CREATE OR REPLACE PROCEDURE abstract_menu (p_letting IN VARCHAR2,
p_results OUT SYS_REFCURSOR)
IS
BEGIN
OPEN p_results FOR
SELECT DISTINCT
SUBSTR (l.letting, 3, 2)
|| '-'
|| SUBSTR (l.letting, 5, 2)
|| '-'
|| SUBSTR (l.letting, 1, 2)
lettingdate,
l.lcontid contractid,
SUBSTR (q.cprojnum, 1, 10) projectnumber,
DECODE (TRIM (MIN (j.route)), NULL, 'N/A', TRIM (MIN (j.route)))
routenumber,
L.DATESTAT statusdate,
L.LETSTAT lettingstatus,
(q.cdescr) jobdescription,
INITCAP (q.clocat1 || q.clocat2) LOCATION
FROM vendor v,
vendaddr r,
letprop l,
planhold p,
proposal q,
project j,
propproj k,
bidlet bd
WHERE v.vendor = r.vendor
AND k.contid = q.contid
AND k.pcn = j.pcn
AND l.lcontid = k.contid
AND p.vendor = v.vendor
AND l.letting = p.letting
AND l.lcontid IN (
SELECT ll.lcontid
FROM letprop ll
WHERE ll.datestat IS NOT NULL AND ll.letting = p_letting AND ll.letstat 'R'
)
AND l.CALL = p.CALL
AND r.addrnum = p.billto
AND bd.letting = l.letting
GROUP BY q.cdescr,
q.clocat1,
q.clocat2,
bd.letting,
l.letting,
l.lcontid,
q.cprojnum,
L.LETSTAT,
L.DATESTAT
ORDER BY lettingdate;
end;
/
SY.
Tags: Database
Similar Questions
-
Return multiple values from a function in a SELECT statement
I hope I've provided enough information here. If not, let me know what I'm missing.
I create a view that will combine the information from several tables. Most are pretty simple, but there are a couple of columns in the view that I need to get by running a function within a package. Even if this is quite simple (I have a function named action_date in a package called rp, for example, that I can use to return the date that I need through SOME rp.action_date (sequence_number).
Here is the question: I really need to return several bits of information of the same record (not only action_date, but also action_office, action_value, etc.)-a join of the tables will work not here, as I will explain below. I can, of course, perform a function separate for each statement, but this is obviously inefficient. Within the select statement of the view, however, I don't know how each of the values that I need to get back.
For example, right now, I have:
Table 1:
sequence_number NUMBER (10),
name varchar (30),
...
Table2:
Table1_seq NUMBER (10),
action_seq NUMBER (10),
action_date DATE,
action_office VARCHAR (3),
action_value VARCHAR (60),
...
I can't just simply join Table1 and Table2 because I have to perform processing in order to determine the rows returned matching, I really need to select. If the package opens a cursor and treats each line until it finds the one I need.
The following works but is ineffective since all calls to the package returns the columns of the same record. I don't know how to put all the values that I need in the SELECT statement.
CREATE VIEW all_this_stuff AS
SELECT sequence_number, name,
RP.action_date (sequence_number) action_date,
RP.action_office (sequence_number) action_office,
RP.action_value (sequence_number) action_value
FROM table1
Is there a way to return multiple values in my SELECT statement or I'm going about this all wrong?
Any suggestions?
Thank you very much!Hello
What you want is a Query of Top - N , what you can do using the ROW_NUMBER analytic function in a subquery, like this:
WITH got_rnum AS ( SELECT action_seq, action_dt, action_office, action_type, action_value , ROW_NUMBER () OVER ( ORDER BY action_date , action_seq , action_serial ) AS rnum FROM table2 WHERE action_code = 'AB' AND action_office LIKE 'E' -- Is this right? ) SELECT action_seq, action_dt, action_office, action_type, action_value FROM got_rnum WHERE rnum = 1 ;
As written, this returns a single line (at most).
I suspect you'll actually get a rank for each group , where a group is defined by a value in a table in which you join.
In this case, add a PARTITION BY clause to the ROW_NUMBER function.
If post you a small example of data (CREATE TABLE and INSERT statements), I could show you exactly how.
As I don't have your tables, I'll show you the use of the tables in the scott schema.
This is a view containing data in the scott.dept table and also to scott.emp, but only for the highest employee in each Department (in other words, the employee whose oldest hire date). If there be a tie for the first hire date, while the candidate with the lowest empno is selected.CREATE OR REPLACE VIEW senior_emp AS WITH got_rnum AS ( SELECT d.deptno , d.dname , e.empno , e.ename , e.hiredate , ROW_NUMBER () OVER ( PARTITION BY d.deptno ORDER BY e.hiredate , e.empno ) AS rnum FROM scott.dept d JOIN scott.emp e ON d.deptno = e.deptno ) SELECT deptno , dname , empno , ename , hiredate FROM got_rnum WHERE rnum = 1 ; SELECT * FROM senior_emp ;
Output:
. DEPTNO DNAME EMPNO ENAME HIREDATE ---------- -------------- ---------- ---------- --------- 10 ACCOUNTING 7782 CLARK 09-JUN-81 20 RESEARCH 7369 SMITH 17-DEC-80 30 SALES 7499 ALLEN 20-FEB-81
Moreover, one of the conditions to the query you posted has been
action_office LIKE 'E'
which equals
action_office = 'E'
(AS is always equivalent to = if the string that follows AS does not contain the winning cards.)
Did you mean say that or did you mean something like this:action_office LIKE 'E%'
Instead?
-
a problem in passing multiple values in the loop settings for
Hi all
I am facing a problem in passing multiple values in the loop settings for.
EX:
CREATE or REPLACE PROCEDURE (pr_id OUT NUMBER) HAVE
tab type is table of NUMBER;
TEMP_TAB TAB;
BEGIN
Select the COLLECT LOOSE pr temp_tab pr_id;
I'm in 1.TEMP_TAB. loop of COUNTING
PR_ID: = temp_tab (i);
end loop;
END TEST;
OUTPUT:-
pr_id = 234578
in the example above, I'm only a value as an out parameter. but I send you PR_ID of the loop.
why I don't get all the values that the parameters.please offer a solution for me.
Thank you my friend.More clarification, let's look at your code...
-- create a procedure and have a single numeric out variable CREATE OR REPLACE PROCEDURE TEST ( pr_id OUT NUMBER ) AS -- declare a type as an array of numbers type tab is table of NUMBER; -- declare a varianble of that array type TEMP_TAB TAB; BEGIN -- query all the values from the table into the array select pr_id BULK COLLECT INTO temp_tab from pr; -- loop through each value in the array for i in 1..TEMP_TAB.COUNT loop -- set the value of the single OUT parameter, OVERWRITING any previous value it has PR_ID := temp_tab(i); -- loop around to the next value end loop; -- end the procedure with the final value of PR_ID END TEST;
-
Passing multiple values at the request of the State (no status page)
Hello
[APEX 4.2.4.00.08 on the 11.2.0.3 database]
I didn't know how to explain briefly what I need in the title of the discussion, that's why I added the song "(non page rapport)". " I met a lot of threads associated with passing of selections multiple values from one page to another, or via a URL from one page to another. I know how to do this. The problem I have right now is trying to pass the commas of the values contained in an application to a report query element. Here's where the "(rapport non page) ' comes into play." I refer to the report query at the level of the application (i.e. shared components-> report queries). I wish really it had another name for it. "Report on the application of queries", perhaps?
In any case, my report query has a bind variable, AI_ID_NUMBERS, that is defined correctly in the shared-> components report queries. However, when this item application has multiple values such that AI_ID_NUMBERS = 4, 5, 6, 7 etc., my URL looks like this:
myapexsite.com/f? p = 456:2:1234567890:PRINT_REPORT = report_1:AI_ID_NUMBERS:4, 5, 6, 7
So, this returns only one record for the report where the identification number is 4, one. I tried a string parameter of Substitution of Application (URL_REPORT_1) with the two following variants (for which both return only a single record):
Substitution string = URL_REPORT_1 and Substitution value = f? p = & APP_ID.:0 : & SESSION. : PRINT_REPORT = report_1:AI_ID_NUMBERS: & AI_ID_NUMBERS.
Substitution string = URL_REPORT_1 and Substitution value = f? p = & APP_ID.:0 : & SESSION. : PRINT_REPORT = report_1:AI_ID_NUMBERS:-& AI_ID_NUMBERS. \
returns...
myapexsite.com/f? p = 456:2:1234567890:PRINT_REPORT = report_1:AI_ID_NUMBERS:4, 5, 6, 7
myapexsite.com/f?p=456:2:1234567890:PRINT_REPORT=report_1:::AI_ID_NUMBERS:\4,5,6,7\
.. .respectively
I really thought that the backslashes would have solved the problem. Any ideas why my report request (PDF) returns only one line?
Thank you
-Seth.
Well, too bad. I realized the mistake I did.
When you work with 'request report queries', there is an option to include variable bind, for example the application or page elements. I had already done that, but for some reason, thought that I also had to pass the parameter and its values in the URL. This is not necessary since the report query query already has the issue of the application/page related to it. The following URL works fine:
myapexsite.com/f? p = 456:2:1234567890:PRINT_REPORT = report_1
And, Yes, it's the URL that is provided when you set up a "application report query. I was thinking too hard.
-Seth.
-
Passing multiple values to the report
Hello
I have a form of parameter. One of the field will have at least one value. When there are multiple values, the values will be separated by a comma and pass on to the State. Please tell me how to separate them and put them in the citation in the report query.
EX: values are: PO, DR
There will be in the where condition as: where code in ('OP', 'DR');
Thank you in advance.
PS. I use 10g
Published by: 945599 on 10 July 2012 14:04Hello
I sent the unit test by mail.
Please note that there are some hardcoded values when you use run_report_object (name of report server and host name).Kind regards
AlexPublished by: AlexDiniasi on 19.07.2012 17:14
-
passing multiple values of the column to a variable in unix
sqlplus -s $USER_ID@$SID/$PWD<<EOF>sql_1.txt set feedback off set heading off select 114032 as c_1 from dual ; EOF for i in `cat sql_1.txt` do sh script_1.sh $i
Currently I am passing a column value to the single unix variable.
How can I pass values of 2 columns
sqlplus -s $USER_ID@$SID/$PWD<<EOF>sql_1.txt set feedback off set heading off select 114032 as c_1 ,sysdate c_2 from dual ; EOF sh script_1.sh $col_1_value $col_2_value
I'm on SUNOS
You can concatenate the columns in SQL by a delimiter, and then use the cut (for example) under Unix to analyze the production line in chips for the script.
-
in PHP how pass a value from the recordset object via a url
I have a blog set up with PHP/MySQL with two tables (1 table for blog entry) and 1 table for comments on the blog
I can view the blog and the comment with a LEFT JOIN recordset like this-
SELECT golf_blog.blog_ID, DATE_FORMAT (golf_blog.blog_created, "%%b, %Y ') AS blog_created, golf_blog.blog_author, golf_blog.blog_subject, golf_blog.blog_article, blog_comments.comment_article
FROM golf_blog LEFT JOIN blog_comments using (blog_ID)
ORDER BY golf_blog.blog_created ASC
I have a link in the this object recordset repeat region goes to a page containing the comment drag.
blog_ID is the primary key of the table blog and blog_ID is the index in the array of comment.
How do you pass the blog_ID of the recordset on a text field in the form of comments via the link insertion?
Or am even thinking about it in the right way?I figured it out and got it to do work in passing the blog_ID as a variable on the URL of the comment form page
the link looks like this
">Commentand on the comment page used this code
$blog_ID = $_GET [$blog_ID]? >and the Insert field value is
I guess that reading David Powers begins to bear fruit. Eureka!
-
Who knows how to pass a value from the form on the next page of javascript?
I have a simple drop-down list. Maybe this isn't the best way, but I use the MM_goToURL function on the onchange event. It works very well so he can redirect without clicking on the submit button.
What I need to do, it's pass the value selected on the next page and grab it so I can use Coldfusion to manipulate the results.
Help, please.The answer is too simple. Just use javascript to submit the form onchange.
-
Need to use values from the first query in other queris to the data model
Hello
Here is my requirement-
I use the data model to run multiple queries. The first query, I get 10 records. Now, I want to use these 10 records in the second query to get my final result. I am not able to use the sub query as the two motions are quite long and complex.
Select distinct Bishop of emp
Select empno, emp where Bishop in (: Bishop)
I can't use: Bishop because it will give only the last value stored at Archbishop. Is it possible to be able to use all the values from the first query in the second query using the data model?Hello
Are you sure that you have your "dataStructure" configured correctly? Try this simple example:
Hope this helps
Andy
-
Hello:
How to configure contextual events publish several values of payload?
On click of a button, I'm declaritively publish a contextual event, which works very well when a single value is passed to the event handler.
My event handler method has the signature of:
eventHandler (String)
But now I also have an oracle.jbo.domain.Number, so my new eventHandler looks like this:
eventHandler (Number, String)
How to pass two values during editing of the event and how to place the payload with multiple values for the new eventHandler?
All article or code would be greatly appreciated.
Thanks for the help.You define a bean holding your values and pass an instance of the bean as a payload...
Timo
-
display multiple values at the completion point
All,
IAM create multiple entries for autopopulate point as shown in this jquery plugin link below but iam trying to change that, then values from the query to the table. How can I achieve even using web services apex 4.1.1 but iam trying NOT to use remote url or external file?
http://jQueryUI.com/AutoComplete/#multiple
concerning
All,
I'm still digging around and looking everywhere but this blog below how I can pass the valueset returned to my jquery as variable below.
sample:
http://ORA-00001.blogspot.com/2010/02/ref-cursor-to-JSON.html
var availableTags is ['data1', 'data2', 'data3'];.
concerning
-
spend multiple values on the interaction of click value
Hi gurus:
I have a requirement where I need to display a report of the first (a table or a PivotTable), with the type Cust_ID, recipes, etc. Cust_id is a unique dimension. Most of the stuff is made.
And then the user wants to select 4 different values of Cust_ID and run another report of detailed comparison of the attributes of these clients.
Now, the solution I proposed one or the other was a copy and paste in the new edition box prompt, or multiple selection on cust_id on new page.
But the 'expert' user interface wants something like boxes to tick next to all ranks and press a button that automatically starts a comparison report.
I know that we can pass a value to the other report using the value interaction. But how I spend 4 different values to the click?
Or is there no other way?
Please help me.
VSorry there not be useful. I think that the solution works and book it that the user needs. Article is that sometimes we spend too much time trying to satisfy a user wants and brings us to spend our valuable time that could be spent more productively. Well...
Good luck, however, Vinay!
-
Hi all
I'm doing a vi where I save the selected value from the ListBox with values respective tab control dropdown selected in another list box. Whenever I select Item1 can change of course and the respective tab will be open for this element. But now I want to just save the selection and put it into another ListBox.SO I can't renmove or add my wishes. Please help me.
It will work.
Probably not the greatest solution well.
-
Impossible to select the value from the search screen (quick select, then) on OFA
Hello
We have a problem with a user who are not able to select any value from the LOV on any page of the Oracle.
1. click the button of LOV
2. search + go
3. Select or quick selection nothing happens (error on the Page appears in the left corner of the homepage)
4. only cancel works.
Any suggestion would be appreciated.
I saw a similar question posted Impossible to select the value from the search screen (quick select, then) on OFA
But unfortunately this is not the answer.
Thank you
Sam
Display of the solution to help others. I tried to connect a SR and suddenly a pop Note ups that helped.
The problem is related to the profile "Self Service Accessibility Features" customer has defined for the user concerned.
Follow these steps:
1 change the value of 'None' profile at the user level.
2 disconnect / connect to the application and testing.
See you soon.
-
Restore the default value from the drop-down list
Hyperion Inreatctive reports.
I have an embedded in a dashboard report. I drag the lists that filter the report. Filter feed results and it works fine.
I want to put a command button on the dashboard that restores the default values from the dropdown lists. I have a selection in each drop-down menu, 'all '. "All" is the default value.
For example, for the year
drop_Year
for the region:
drop_Region
What command should I put on the command button that any value is displayed in the drop-down lists of this command, restore it to "all"?
Watch the Select() method
w
Maybe you are looking for
-
Remove the Labview evaluation software watermark
Hi, I've migrated my test environment software LabView2009 and TestStand4.2.1 to LabView2011 and TestStand2010. Test software is then installed on the target machines where is allowed only TestStand RunTime, while LabView adapters is configured to us
-
error code when I try to load windows live messenger
retail fm computer handle windows JournalLog name: ApplicationSource: Application errorDate: 2010-02-23 13:56:52Event ID: 1000Task category: (100)Level: errorKeywords: ClassicUser: n/aComputer: trish-PCDescription:Failing application msnmsgr.exe, ver
-
If the controller supports 50 ap, and there is actually 58 ap, if I turn off the 8 administratively, I will see then the 50 others who are on the rise? I guess the question is if the controller manages 50 ap irrespective of the status or 50 ap active
-
Follow-up of scroll of featured Alps pointing device works not
Hardware and drivers > Alps pointing device, touch, apoint pad or whatever, the scroll track left works again. Troubleshooting fixed it once. How can I fix it again? Also why so many different names for the same device? __
-
PC to TV via the PC USB out and DVI/HDMI Converter - it will work?
My Dell Inspiron AIO PC is brilliant but strangely doesn't have any video on port (why not, Dell?). I want to be able to show images of HD quality from this PC to my TV in 1080i HD. Is this possible via the PC USB2 port via an external converter of D