Extract a column of the cursor to type set
HelloI have a procedure that returns a complex cursor (all columns are known) - I need to enter my type defined a single column of a cursor (number table - I use it later in the SQL statement) - what is the best way to get it? Or is it possible to use received cursor (column) directly in sql? (I would avoid if possible iteration)
Concerning
BartlomiejD
How can I load m_cCursor in retNA (TNUMBERARRAY) colNum?
Here's a simple way
SQL> CREATE OR REPLACE PACKAGE pkg
AS
TYPE tcursor IS REF CURSOR;
TYPE tnumberarray IS TABLE OF NUMBER;
PROCEDURE retcursor (retcursor OUT tcursor);
PROCEDURE retnumberarray (retna IN OUT tnumberarray);
END pkg;
/
Package created.
SQL> CREATE OR REPLACE PACKAGE BODY pkg
AS
PROCEDURE retcursor (retcursor OUT tcursor)
AS
BEGIN
OPEN retcursor FOR
SELECT 'A' cola, 'B' colb, 'C' colc,
CURRENT_TIMESTAMP cold, LEVEL colnum
FROM DUAL
CONNECT BY LEVEL <= 20;
END retcursor;
PROCEDURE retnumberarray (retna IN OUT tnumberarray)
AS
m_ccursor tcursor;
BEGIN
retcursor (m_ccursor);
SELECT x.COLUMN_VALUE.EXTRACT ('ROW/COLNUM/text()').getnumberval ()
BULK COLLECT
INTO retna
FROM table (XMLSEQUENCE (m_ccursor)) x;
FOR i IN 1 .. retna.COUNT
LOOP
dbms_output.put_line (retna (i));
END LOOP;
/*
How Can I load colNum from m_cCursor into retNA(TNUMBERARRAY)?
I would like to use it later in statment like
Select * from SOMETABLE ST, Table(retNA) NA
WHERE ST.ID = NA.ID and ...
*/
END retnumberarray;
END pkg;
/
Package body created.
SQL> DECLARE
x pkg.tnumberarray;
BEGIN
pkg.retnumberarray (x);
END;
/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
PL/SQL procedure successfully completed.
I would use it later in the statement as
Select * from SOMETABLE ST, Table (retNA) NA
WHERE ST.ID = NA.ID and...
Beware that you cannot SELECT collections defined in PLSQL. You must set them in SQL ;)
Tags: Database
Similar Questions
-
massive many update column of the cursor?
I have the problem of finding how to make an update of several columns using the update statement block (if possible). I know how to do it using merge or correleated update, I just want to know how to write using features in bulk by pl/sql. Here's the code for the sample tables:
Now, I want to update original emp table with job, sal, comm emp_tmp table for some empnos. So I write:create table emp_tmp as select empno, job, sal, comm from emp where deptno = 30; update emp_tmp set sal=1000, comm=200, job='CLERK'; commit;
I can't understand the syntax above idea in bulk using statements. Could you give me some advice about this? How it should be written?declare cursor c is ( select e.empno, t.job, t.sal, t.comm from emp e, emp_tmp t where e.empno = t.empno and e.empno > 7700 ); begin -- ... here I would like to use bulk feature for update statement on emp end;
Thank youA sample:
declare cursor csr is ( select t.empno, t.job, t.sal, t.comm from emp_tmp t where t.empno > 7700 ); type t_emp is table of csr%rowtype; t_emp1 t_emp; begin open csr; loop fetch csr bulk collect into t_emp1 limit 100; forall i in 1..t_emp1.count update emp set sal = t_emp1(i).sal where empno = t_emp1(i).empno; exit when csr%notfound; end loop; close csr; end;
-
ADF table filter - date column - in the table data type is timestamp
Hello
I want to filter adf table based on the time stamp column, but unable to do so.
Details.
- The data type of the column (dateAdded) in the database is timestamp.
- the type of this column in the mode attribute is oracle.jbo.domain.Timestamp. and the format is DD/MM/YYYY
- the part of the code in my page jspx is
< af:column sortProperty = filterable "DateAdded" = "true" width = '80' sortable = "true" headerText = "creation Date" id = "c6" >
< f: facet = name 'filter' >
< af:inputDate value = "#{vs.filterCriteria.DateAdded}" id = "id1" > "
< af:convertDateTime pattern = "dd/MM/yyyy" / >
< / af:inputDate >
< / f: facet >
< af:outputText value = "#{rank." DateAdded}"id ="ot5">
< af:convertDateTime pattern = "#{bindings." MYCASE_CONS_VO1.hints.DateAdded.format}"/ >
< / af:outputText >
< / af:column >
4. everything by filtering this field giving entered in the format DD/Mm/yyyy, the query runs but no change in the result (the value of this field in the table lavel is 10.54.16.000000000 18 June 14 h)
Note: In the interface user, the value of the field is display in the format DD/MM/YYYY.
Please feel free to ask me questions. Enjoy for little help.
Thank you
ASIS
You can try with that mentioned in the link:
http://dkleppinger.blogspot.in/2011/09/how-to-ignore-time-component-of-date.html
-
Insert/update the column with the clob data type
Hi all
ORCL Version: 11g.
I have a table with the clob data type.
Test12
(col1 clob);
I'm trying to insert/update to update the column with more than 4000 characters.
But due to the limitation of tank 4000, I could not Insert/Update.
Need your help in resolving this issue.
THX
Rod.
The limit of 4000 characters is incorrect. That pertains only to the varchar2 data type. A clob can hold more than 4 G.
Here is an example that shows how to insert it, I found...
Otherwise, here is a way 'dirty' to do.
insert into your_table (COLA, COLB)
values
(PRIMARY_KEY, PART 1 OF DATA)
;
Update your_table
Define COLB = COLB | PART 2 OF BIG DATA
where COLA = PRIMARY_KEY;
Update your_table
Define COLB = COLB | PART 3 OF BIG DATA
where COLA = PRIMARY_KEY;
.. and so on...
I don't know that I personally recommend the second style... But he could do the job.
-
I am designing a banner for my website. I have a background layer, a layer of photo image and I try to create my text layer. I select horizontal T, place the cursor in the desired position and type. I get a horizontal line... no letters. Can someone tell me what is the problem and how to solve this problem, so I can't see letters? Thank you!
Right now, your question is marked as "not responded". If my or anyone's answer solved your issue. Mark your question as answered and mark the answer displayed as 'correct', only you can do. It helps when the moderators of the forums of audit.
-
Column with the data SDO_GEOMETRY type
Friends,
I want to create a Table that has a column as data SDO_GEOMETRY type. How to create the table in the scenario.
For example: the name of the Table-> ABC
COLUMNS: A NUMBER, B VARCHAR2 (50), C_GEOMETRY SDO_GEOMETRY, date D
We must respect the rules and regulations to create this table with a column as SDO_GEOMETRY. I know not any data SDO_GEOMETRY type. Please explain.
Thank you
ShakurIt is a type of data object used to store spatial data. You can describe the type entering this into your sql * plus the term:
describe sdo_geometry
I recommend you read some of the documentation. This topic covers it well:
http://download.Oracle.com/docs/CD/E11882_01/AppDev.112/e11830/sdo_intro.htm#i884907 -
See the column position of the cursor in the code view
I realized this was requested in 2008...
Is there a way to display the character column where the cursor was when in code view? And consider the size of the tabs (i.e., counts tabs as the number of characters)? I'm trying to make sure align various blocks of code in classic asp massively complex (and ugly) code...
Thank you.
The current version of Dreamweaver does not display the column number. However, the media don't.
In parentheses is a free, open-source editor created by Adobe. It was announced last year that consoles will be integrated in the next major release of Dreamweaver, and that a public beta would be released sometime this year. You can either wait that the public beta version (should be pretty quickly), or you can download media immediately.
-
Check the syntax of the cursor
Hi all,
I'm no expert of PL/SQL. I have to do an update to a table using a cursor.
I saw a guide on the internet and I have created this script:
Set serveroutput on
DECLARE
REC NŒUD$ % ROWTYPE;
cursor cur is select ID, NODE_ID OF THE NŒUD$;
BEGIN
Open the heart;
loop
News of FETCH in rec;
When the output cur % NOTFOUND;
UPDATE LINK$ SET a.END_NODE_ID = rec. Node_id WHERE a.T_JNCTID = rec.ID;
dbms_output.put_line ('update 1': cur % ROWCOUNT);
UPDATE LINK$ SET a.START_NODE_ID = rec. Node_id WHERE a.F_JNCTID = rec.ID;
dbms_output.put_line ('update 2': cur % ROWCOUNT);
end loop;
close cur;
end;
/
Set serveroutput off
commit;
I'm not sure that the bold line is correct. I don't understand what that means.
Can you help me?
Thank you in advance.Because the fetch statement fails when you try to store the cursor file in CDR which is ROWTYPE table NŒUD$.
The number of columns in the ROWTYPE variable must be equal to the number of columns in the CURSOR. So if the NŒUD$ table has more than two columns your extraction will fail.See the example below:
SQL> declare 2 my_tab emp%rowtype; 3 cursor c1 is select empid from emp; -- I select only one column here and it fails 4 begin 5 open c1; 6 fetch c1 into my_tab; 7 close c1; 8 end; 9 / fetch c1 into my_tab; * ERROR at line 6: ORA-06550: line 6, column 1: PLS-00394: wrong number of values in the INTO list of a FETCH statement ORA-06550: line 6, column 1: PL/SQL: SQL Statement ignored SQL> ed Wrote file afiedt.buf 1 declare 2 my_tab emp%rowtype; 3 cursor c1 is select * from emp; -- I select all columns from emp table and it works fine 4 begin 5 open c1; 6 fetch c1 into my_tab; 7 close c1; 8* end; SQL> / PL/SQL procedure successfully completed. SQL>
Published by: AP on Oct 14, 2010 03:54
-
Picker on the item of type varchar2.
Hello
IM using apex Oracle 5.0...
I have two columns with the VARCHAR2 data type... I want to keep the date value in these columns... But in the apex when I change the type of the text date picker it displays error invalid number during the race... Is it possible to use the datePicker in any other way? I can't change the data type for these columns to date because it has a number of records in the table.
Need a solution for this problem...
Thank you
Infant Raj.A
Infant salvation
Have you tried to use Post calculation calculation of date picker? It allows you to convert the varchar2 date.
In the image, you must replace "DATE_PICKER_FORMAT" with the format that you have in the article, something like "DD/MM/YYYY '.
Sergio
-
onMouseOver displays the ToolTip of hidden column of the classic report
What: The goal:
Access more information that fits on a single line of the screen without using multiple fixed lines.
Background:
Classic report with 18 data elements (columns) visible. At the search box, and the user can choose the number of rows displayed.
Some data elements can be long (20 to 30 characters) compared to the width of the screen. The element more right data risk of 100 characters.
Proposed strategy:
(1) display the n first characters of the item (s) long in the report.
(2) display the entire item onMouseOver.
Proposed approach:
(1) for each column with the data of type long, contain the integer value in a hidden item.
(2) value of (hidden) long display in tooltips (bubble? / ball?) on this value onMouseOver.
Note: It is not framed to help/Help for a column but the display of the value of long type for a particular element in the line of a column.
Search feature:
(1) to reduce maintenance, wants to set up for several columns using a single common block of code.
Question:
In view of the other approaches, you know, it's a good approach to achieve the goal? Alternative approaches?
HowardWell it took some time, and you really made me work for it. :)
For flight hover end result on the job column Ln Nm.
http://Apex.Oracle.com/pls/Apex/f?p=991202:1I added some old code, I had laying around. It adds a bubble that will stay for 5 seconds or until you click Next or move to another record.
What I would do at this point, it is simply truncate the length of the Nm long to something short (with a substr). Use any indicator wished to hover. Like for example these glasses it's really up to you.
You will see there is a PLSQL AJAX callback where you can retrieve and format the content of the pop-up window to everything you want. You can make it real.
Here's what I did:
1. the new procedure of ShowJob javascript.function ShowJob(pThis,pId){ this.dTimeout; clearTimeout(this.dTimeout); this.dGet = dGet; this.dShow = dShow; this.dCancel = dCancel; var get = new htmldb_Get(null,$v('pFlowId'),'APPLICATION_PROCESS=FULL_LONG_NAME',$v('pFlowStepId')); this.dGet(); return; function dGet(){ this.dTimeout = setTimeout("this.dCancel()",6500); get.addParam('x01',pId); get.GetAsync(dShow); } function dShow(){ $x_Hide('rollover'); if(p.readyState == 1){ }else if(p.readyState == 2){ }else if(p.readyState == 3){ }else if(p.readyState == 4){ $x('rollover_content').innerHTML = p.responseText; $x_Show('rollover'); var l = findPosX(pThis)+pThis.offsetWidth+5; var t = findPosY(pThis); $x_Style('rollover','left',l + 'px'); $x_Style('rollover','top',t + 'px'); // This math would center on the vertical // $x_Style('rollover','left',findPosX(pThis)+pThis.offsetWidth+5); // $x_Style('rollover','top',findPosY(pThis)-($x('rollover').offsetHeight/2)+($x(pThis).offsetHeight/2)); document.onclick = function(e){ dCheckClick(e); } }else{return false;} } function dCheckClick(e){ var elem = html_GetTarget(e); try{ var lTable = $x_UpTill(elem,"DIV"); if(lTable.id!='rollover_content'){dCancel();} else{} }catch(err){dCancel();} } function dCancel(){ $x_Hide('rollover'); document.onclick = null; get = null; } }
2 rollover div on the page footer (div id = "reversal"...). Of course, this could also be a region.
< div id = "reversal" style = "display: none;" color: black; background: #FFF; border: 2px solid #369; width: 290px; position: absolute; padding: 4px; » >
< div id = "rollover_content" > < / div >
< / div >3 PLSQL AJAX callback. : FULL_LONG_NAME
-- select your value with apex_application.g_x01 htp.p('You hover over ' || apex_application.g_x01 || '
'); htp.p('Here is the Full Long Name: XXXXXXX XXXXXXX XXXXXXX 1234565');4 changed the Nm of Long column to have a link with the onmouseover call that calls the new procedure ShowJob. I made the assumption that with the NUM parameter, you could go the full record of what you need.
onmouseover = "ShowJob(This,#num#) '"This should be it.
Let me know what you think.
-JorgePublished by: jrimblas on April 22, 2013 13:05: added code to validate for the completion
-
How to get a column using the logical AND operator on two columns?
All columns are the VARCHAR2 data type.
I got out of the table in this way:
col1 col2
but I want an extra column in this way:
True True
True false
False falsecol1 col2 result
as the clear sound output shows this column resut is logical operator AND
True True True
True false false
Fake fake fake
col1 and col2. How to get there?WITH t AS (SELECT 'True' col1, 'True' col2 FROM DUAL UNION ALL SELECT 'True' col1, 'False' col2 FROM DUAL UNION ALL SELECT 'False' col1, 'True' col2 FROM DUAL UNION ALL SELECT 'False' col1, 'False' col2FROM DUAL) SELECT col1,col2,CASE WHEN col1 = 'True' AND col2 = 'True' THEN 'True' WHEN col1 = 'True' AND col2 = 'False' THEN 'False' WHEN col1 = 'False' AND col2 = 'True' THEN 'False' WHEN col1 = 'False' AND col2 = 'False' THEN 'False' END AS RESULT FROM t
-
Recently, whenever I try to type so that Firefox 9.01, the cursor moves to the left while everything is written backwards. I can normally type into a word document to have done with it and cut and pasted in this message. I use Windows XP. I closed Firefox and restarted my computer twice with no success to solve this problem.
Maybe this recent thread on the issue even helps.
- [910552/questions/910552] It started a few days ago firefox will type back
-
Since the download of Firefox 4, I have problems of archiving gmail conversations since my Inbox view (one or more conversations) as it says 'No. Conversations selected' when I selected one or more. Also, when I go to enter a new event in google calendar, I have to click the cursor in the field type of the event (it used to let me just start typing) or else he bends and begins to jump to the day view or another month. Does anyone know how to fix one of these?
I had this problem; But while trying to solve another problem, I reset my preferences for Firefox and it fixed this problem as well. To reset the preferences, follow this link: http://support.mozilla.com/en-US/kb/Resetting%20preferences
-
Positions the cursor can not extract the subset of waveform
Hello
I try to get two positions the cursor on a graph of waveform for the entries for the code below, which will start a process that will analyze a subset of the wave. The two sliders define the start and endpoint for the waveform (cursor 0 is the starting point, slider 1 is the endpoint). However, I have questions as Labview continues to tell me that the values I have chosen are not the integer multiples of dt. I don't know what it takes to avoid this problem. I tried to get cursor plots are of unique land types so they snap to the values x (I guess it's that simple concession means), but it makes no difference. Note that there are 2 slots originally going to this graph of waveform (waveform original and medium), but the selection should be only one of them (single parcel is attributed to original waveform). Help, please!
Edit - just a quick update. I noticed that if I re - run the VI and activate this part of the VI that supports the subset of waveform, I actually get what I want. So, I guess that I don't put something correctly in another part of the VI where I have a structure of the event that updates the position of the cursor in numerical indicators. Could be the problem?
I solved the problem. Have the two sliders on the plateau at the only plot on the original waveform should have prevented this problem, but I didn't notice that I was feeding in an another waveform beforehand which automatically changes the assignment of the cursor, causing my problem.
Now cursors remain set on the only ground I want after a few adjustments.
-
When you type, the cursor jumps around. How can I correct this situation?
When you type, the cursor jumps around. How can I correct this situation?
It is a very common problem when users become familiar with a new laptop. Either your palm/wrist/cuff/bracelet is touching the touchpad as you type or the touch pad sensitivity is set too high and reacts to strong strikes.- Someone to watch you while you type to see if you accidentally touch touchpad of the notebook.
- Go to the control panel mouse configuration and reduce the sensitivity of the touchpad.
- Make sure you use the latest version of the driver from the manufacturer of the laptop for the touchpad and update if a new becomes available.
- Disable the touchpad entirely in favor of a wireless laptop mouse.
As noted previously, this is a very common problem and users are usually completely unaware they do even when it is pointed out to them.
Maybe you are looking for
-
Satellite A100-649: battery no longer works
Hello I bought a Toshiba Satellite A100-649 in June 2006.Now, 3 months later, the battery no longer works.Toshiba Powersaver says it's 94% of the power,the LED shows that it is loading but it hangs just to 94%. Well, I don't care if he could not load
-
I have a WNR2000v4 connected to a 8canaux, DOCSIS 3 modem surfboard hooked directly into my cable provider. My office is located right by the modem and the router, I have it plugged into the router instead of on the WiFi. At my office, I get a downlo
-
Drive not valid error H:
I have Windows XP Professional SP3 and when I try to install or uninstall an application I get a "Error 1327 - Invalid drive H:". My system does not drive H:
-
CD/DVD drive not recognized by Windows Vista
I installed a suite of burningb of CD and DVD on my Toshiba (under Vista Home Premium). My CD/DVD drive appeared more in the computer and was no longer functional. I deleted the program I installed and apparently caused the problem, but it did not he
-
License of VCS &; MSDS
Hello world I need to clarify some doubts with permission of TMS and VCS: Our customers need to add endpoints SX20, the customer already has a deployment of TP with TMS, VCS Expressway & control, MSE8510. I have two options: 1 - save the SX20 endpoin