|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
WHEN-MOUSE-DOUBLECLICK with more than 1 result rows
Hello
I've displayed scott.emp on canvas-tab1. By doubleclicking on a row I'd like to have the result (depending on the condition) on canvas-tab2. Therefore I use the WHEN-MOUSE-DOUBLECLICK Trigger: ------------------------------------------------------------- DECLARE the_button_pressed VARCHAR2(1); my_current_value_emp VARCHAR(10); cur_blk VARCHAR2(40) := :SYSTEM.CURSOR_BLOCK; cur_rec NUMBER; --top_rec NUMBER; bk_id BLOCK; BEGIN bk_id := FIND_BLOCK( cur_blk); cur_rec := GET_BLOCK_PROPERTY( bk_id ,CURRENT_RECORD); my_current_value_emp := :EMP.SAL; the_button_pressed := :SYSTEM.MOUSE_BUTTON_PRESSED; GO_BLOCK('EMP1'); CLEAR_BLOCK(NO_VALIDATE); SELECT empno ,ename ,job ,mgr ,sal ,comm ,deptno INTO :EMP1.EMPNO, :EMP1.ENAME, :EMP1.JOB ,:EMP1.MGR ,:EMP1.SAL,:EMP1.COMM ,:EMP1.DEPTNO FROM EMP WHERE sal = TO_NUMBER(my_current_value_emp); --END IF; END; ------------------------------------------------------------ If there is just 1 row as result everything is fine, if there are more result-rows ORA-01422 is raised. Why is there a problem with more then 1 result-row ?? How can I solve this Problem ?? |
|
#2
|
|||
|
|||
|
Your query assuming that only one record should be return because of using = operator in WHERE clause, make the following modification in your query then try it.
SELECT empno ,ename ,job ,mgr ,sal ,comm ,deptno INTO :EMP1.EMPNO, :EMP1.ENAME, :EMP1.JOB ,:EMP1.MGR ,:EMP1.SAL,:EMP1.COMM ,:EMP1.DEPTNO FROM EMP WHERE sal IN TO_NUMBER(my_current_value_emp); Regards, |
|
#3
|
|||
|
|||
|
I assume that your query is right. What is the format of your blocks? Form or tabular. canvas-tab2 must be defined as tabular so it can have place holder to store more than one records.
|
|
#4
|
|||
|
|||
|
First it has to be:
WHERE sal IN (TO_NUMBER(my_current_value_emp)); But this does not work. Sorry. Any other suggestions ? |
|
#5
|
|||
|
|||
|
Someone suggested to change the default-where clause:
DECLARE the_button_pressed VARCHAR2(1); my_current_value_dept VARCHAR(2); my_current_value_emp VARCHAR(10); cur_blk VARCHAR2(40) := :SYSTEM.CURSOR_BLOCK; cur_rec NUMBER; --top_rec NUMBER; bk_id BLOCK; L_STR_EMP VARCHAR2(2000) :=' WHERE 1=1'; my_current_value_emp := :EMP.SAL; the_button_pressed := :SYSTEM.MOUSE_BUTTON_PRESSED; L_STR_EMP := L_STR_EMP ||' AND SAL >= '||TO_NUMBER(my_current_value_emp); GO_BLOCK('EMP1'); CLEAR_BLOCK(NO_VALIDATE); SET_BLOCK_PROPERTY('EMP1', DEFAULT_WHERE, L_STR_EMP); EXECUTE_QUERY; END; This works, but maybe there exists some other solutions ?? Thanks for your attention |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > WHEN-MOUSE-DOUBLECLICK with more than 1 result rows |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|