Function within the statement call box SQL
I have a procedure with many cases not to validate inside statements that compare the data in a table and fill in a description of the error of the dates. (snip of the size of the code below)
create or replace procedure "PROC_TEMP_UPDATE" is begin update temp_update set error_desc = CASE WHEN (error_desc != 'MATCH') THEN 'PCFN/TCN combo not found in destination table.' WHEN (error_desc = 'SKIP') THEN NULL WHEN (ge_ata is null and az_ata is not null) THEN 'Enter GE ATA Date before entering AZ ATA Date.' WHEN ((ge_ata is not null and az_ata is not null) and ge_ata > az_ata) THEN 'GE ATA Date cannot be greater than AZ ATA Date.' end proc_temp_update;
Instead of having to enter the bottom 2 when reporting for each date, I created these functions:
(Function 1: check if Date1 is null and Date2 is not.)
Function 2 these two dates are not null, check if Date1 is greater than Date2.)
function Is_D1_NULL (Date1 DATE, Date2 DATE) return BOOLEAN is result BOOLEAN := FALSE; begin if (Date1 is null and Date2 is not null) then result := TRUE; end if; return (result); end Is_D1_NULL;
You cannot use Boolean in SQL queries. You must modify your function to return something like Y/N or 1/0 and assess against that.
That said, move the engine of SQL and PL/SQL is, relatively speaking, cheap, so I let just the comparisons as they are in instruction box instead of calling a function.
John
Tags: Database
Similar Questions
-
Hello
I try to use the VI of unconstrained optimization to fit a measured spectrum. However, each call VI, I get the error:
Error 1 occurred Armijo rule stepsize reduction failed to reduce the value of function within the maxiters
Possible reasons:
LabVIEW: An input parameter is not valid. For example if the input is a path, the path can contain a character not allowed by the operating system such as? or @.
=========================
NOR-488: Command requires controller GPIB be in Charge.Does anyone know what I'm doing wrong and how I can fix this problem?
The VI for the stepsize Armijo rule reduction can be found here:
\vi.lib\gmath\NumericalOptimization\qn_armijo rule stepsize reduction.vi In the current implementation, the spectrum is able to a rectangular spectrum. This may be the cause of the error?
I have attached the screw that I use. They are written in LabVIEW 2010.
Thanks Marc67 for your quick reply, but I found the error.
It was pretty stupid, that I used a bad vector of departure for the unconstrained optimization VI, which was too low values.
-
Call a function within the same CFC component
Hello
/ * Niewbie Question * /.
I have a strange problem. When I try to call one function on the other in the same CFC component, I get an error named: "Entity has incorrect type to be called as a function."
I looked on many forums and searched in Google groups. I have yet found a work around for this problem.
I thought I did caution o not use twice the same name...
Can someone tell me what I did wrong?
My sample code to reproduce this error is included
The full error message is:
Entity is of the wrong type to be called as a function.
The symbol you provided superfunction is not the name of a function.
The error occurred in C:\ColdFusion8\wwwroot\admin\_components\test.cfc: line 6
4: < cfinvoke
5: method = "superfunction".
6: returnVariable = "myReturn" >
7: < / cfinvoke >
8: < cfset some_text = myReturn >
OK, solved with all your advice!
A big thank you to everyone
Here is the final code for others...
-
Function within the package error
Hi friends,
I have a package called xxhw_ams_utils with a function inside get_salary
When I tried to run this function in the package as below average way, im getting error as
ORA-00904: "XXHW_AMS_UTILS." "" GET_SALARY ": invalid identifier
where there are 1072 is the assignment IM id to the objective test.select apps.xxhw_ams_utils.get_salary(1072) from dual
This is the actually the get_salary function located in the package xxhw_ams_utils of coding
Suppose that if I performed as the way to way below, I get the correct resultFUNCTION get_salary (p_asg_id IN NUMBER) RETURN VARCHAR2 IS l_gross VARCHAR2(20); l_basic VARCHAR2(20); BEGIN select eev.screen_entry_value into l_basic from pay_element_entry_values_f eev, per_pay_bases ppb, pay_element_entries_f pe where ppb.pay_basis_id +0 = 61 and pe.assignment_id = 1072 and eev.input_value_id = ppb.input_value_id and eev.element_entry_id = pe.element_entry_id and sysdate between eev.effective_start_date and eev.effective_end_date and sysdate between pe.effective_start_date and pe.effective_end_date; EXCEPTION WHEN OTHERS THEN RAISE; END;
Suppose if I run as the means below it is back as invalid character error.select eev.screen_entry_value --into l_basic from pay_element_entry_values_f eev, per_pay_bases ppb, pay_element_entries_f pe where ppb.pay_basis_id +0 = 61 and pe.assignment_id = 1072------------------------------------>assignment id (that im passing) and eev.input_value_id = ppb.input_value_id and eev.element_entry_id = pe.element_entry_id and sysdate between eev.effective_start_date and eev.effective_end_date and sysdate between pe.effective_start_date and pe.effective_end_date;
Why might the problem friends.select apps.xxhw_ams_utils.get_salary(1072) from dual
Brgds,
MiniYour function must RETURN a VARCHAR2
-
How to call other functions within the ScriptableFunction class
I am trying to create an extension of javascript class which will record audio, but the problem is that I can't call other methods in the class.
clear explanation about my problem:
It's my Scriptable class
public final class OCNUtilsNamespace extends Scriptable { VoiceRecord vr; public OCNUtilsNamespace() { this.vr = new VoiceRecord(); } public Object getField(String name) throws Exception { else if(name.equals("VoiceRecorder")){ return this.vr; } else if (name.equals("stopRecording")) { this.vr.stopRecording(); return new String("Stopped Recording"); } else if (name.equals("startRecording")) { this.vr.startRecording(); return new String("Started Recording"); } return super.getField(name); } }
and here's my ScriptableFunction class:
public class VoiceRecord extends ScriptableFunction { String status = "start"; public Object invoke(Object obj, Object[] args) throws Exception{ if(status.equals("start")) return new String("Started Recording"); if(status.equals("stop")) return new String("Stopped Recording"); return new String("nothing"); } public void stopRecording(){ status = "stop"; return; } public void startRecording(){ status = "start"; return; } }
in my javascript every time I call
alert(OCN.OCNUtils.VoiceRecorder());
I get the response as "recording started"
but whenever I tried to call
alert(OCN.OCNUtils.startRecording());
I don't get all respose and the script will stop working at that time here.
Why is happening like that?
I'm doing something wrong?
I did not understand this concept of scriptablefunction anyone please explain what is happening?
have to apply Runnble to the future because I have to record the sound of the microphone
I suggest that you simply pass an argument of your javascript in your extension like this:
public final class OCNUtilsNamespace extends Scriptable { VoiceRecord vr; public OCNUtilsNamespace() { this.vr = new VoiceRecord(); } public Object getField(String name) throws Exception { if(name.equals("VoiceRecorder")){ return this.vr; } return super.getField(name); } }
and on your class that extends a ScriptableFunction,.
public Object invoke(Object obj, Object[] args) throws Exception{ String param = args[0].toString(); // Cast a parameter from your js to a string if(param.equals("start")) return startRecording(); if(status.equals("stop")) return stopRecording(); return new String("nothing"); } public String stopRecording(){ status = "stop"; return status; } public String startRecording(){ status = "start"; return status; }
Finally, call your extension via javascript like this:
alert(OCN.OCNUtils.VoiceRecord("start")); // Call the startRecording() on your VoiceRecord class alert(OCN.OCNUtils.VoiceRecord("stop")); // Call the stopRecording() on your VoiceRecord class
Hope this helps
-
make sure that the procedure, called pl/sql from apex DURATION
Hi gang,.
I was wondering what the thoughts of the people where assuring him a packaged procedure is called in a session of runtime Apex, as opposed to sql * more or elsewhere.
For example, how apex_mail.send to validate and output the following if executed from sql * more:
ORA-20001: this procedure must be called from a session of the application.
A simple call to check v ('APP_USER') wouldn't is not null enough?
See you soon,.
ScottWEHello
I think you could use the APEX_CUSTOM_AUTH.IS_SESSION_VALID function
http://download.Oracle.com/docs/CD/E14373_01/apirefs.32/e13369/apex_auth.htm#BABHDFIIExample of
CREATE OR REPLACE PROCEDURE my_procedure(p_poaram1 VARCHAR2) AS BEGIN IF APEX_CUSTOM_AUTH.IS_SESSION_VALID THEN -- do stuff here when session is valid ELSE raise_application_error(20001,'Session is not valid'); END;
BR, Jari
-
Function in the procedure call
Hi team
I have a question, if I create function inthat I create procedure then how to call the procedure only please give little example
Thank youHello
Here is a little example:
SQL> set serverout on SQL> create or replace function test 2 return varchar2 3 as 4 my_var varchar2(4); 5 -- 6 procedure my_proc 7 is 8 begin 9 dbms_output.put_line('Hello World'); 10 end my_proc; 11 begin 12 my_proc; 13 my_var := 'Done'; 14 return my_var; 15 end; 16 / Function created. Elapsed: 00:00:00.01 SQL> select test from dual; TEST ---------------------------------------------------------------------------------------------------- Done 1 row selected. Hello World Elapsed: 00:00:00.04
-
Master-detail functionality between the regions of PL/SQL and IR possible?
4.2.1
THM 2
Hi all
We have two regions in a page. The upper region is a region of PL/SQL that lists the 5 best wages by Dept. This was not done using traditional reports because management wanted a "dashboard" as the look and feel that is already existing and what is happening in that it is a pl/sql block that has the sliders and the necessary HTML, CSS in there.
Below that is an IR when the user clicks on the dept of region of PL/SQL, it will refresh the IR below to display all employees in this Department
Top of the page shows region of PL/SQL
EMP name Dept wage
Emp1 10 10000
EMP2 10 950
Emp3 20 800
The Dept field is a hyperlink.
When we click on Dept on this region of PL/SQL
The lower IR should be updated (without submit page)
Output
Emp1 10 10000
EMP2 10 950
It is a kind of master-detail relationship between PL/SQL and Report (Detail) (Master) area Interactive
We can hyperlink in the SQL in pl/sql area, but you wonder how trap line and pass the dept id to the IR and get this region to refresh account?
All suggestions from the experts?
Thank you
Ryan
It is a way to pass the info in connection
Perform the dynamic Action of the link column report
The dynamic action can submit the session state value, and then refresh the IR.
On either by the way, you must create dynamic PL/SQL region to solve this problem, see this
APEX reports: layout custom with a column named (model line)
-
Set the values of constraint within the States
Hi all, in the attached code I have a condition called "pods1" - I have a canvas called pod1 when I am in design mode and I change my status to "pods1", it works fine - but if I change this State programmatically, it said 'left' can be found in < mx:canvas > object? in design mode, he can see the parameter and the code, that it seems strange
Any help much appreciated.
I found a workaround - in the example above if you use the following: -.
SetStyle seems to work as we would expect there would be SetProperty!
Concerning
SWT -
How to generalize the statement below box?
I have below logical case that I need to remove the coding hard of the year field based on the ranges of the year below. Perhaps using another function and make more generic?
insp_dt = Date
po_id = Varchar2 (5)
Expected result for season_year is:SELECT DISTINCT DECODE(SUBSTR(UPPER(a.PO_ID),1,1),'S','SP','U','SU','F','FA','H','HO')|| CASE WHEN TO_CHAR (a.insp_dt,'YYYY') < 1999 THEN '9' WHEN TO_CHAR (a.insp_dt,'YYYY') between 1999 and 2008 THEN '0' WHEN TO_CHAR (a.insp_dt,'YYYY') between 2009 and 2018 THEN '1' WHEN TO_CHAR (a.insp_dt,'YYYY') between 2019 and 2028 THEN '2' WHEN TO_CHAR (a.insp_dt,'YYYY') > 2028 THEN 'x' END ||substr(a.po_id,2,1) AS season_year FROM MAP.finished_goods_audit a
SP06 (SP + 0 + 6 obtained from the instruction box for spring 2006)
SU10 (SU + 1 + 0 obtained in the instruction box for summer 2010)
HO99 (HO + 9 + 9 from the instruction box for holiday 1999)What picking the third character in the string of the YEAR?
SUBSTR(TO_CHAR(a.insp_dt,'YYYY'),3,1)
-
How to get the item currently being processed within the State
Will there be any environment variable that contains the element, as there are some pages and app?
I would use it in terms of the element. The condition would be coded in a package and called several times through the elements. The problem now is that I need to pass the name of the element in the parameter of the function.
Any idea?It is not available. We hope to provide this in a future release to allow plans for leave to use a code generic, similar to your goals.
Scott
-
SQL functions in the area of Pl/Sql does not
Hi all
I created a region of pl/sql like this
This is the example from denes kubicek
but the functions do not work?DECLARE v_counter INTEGER := 0; v_line VARCHAR2 (4000); v_rec_in_row INTEGER := 6; BEGIN HTP.prn ('<table>'); HTP.prn ('<tr>'); HTP.prn ('<td>'); FOR c IN (SELECT CASE WHEN LOWER(SUBSTR(SUBSTR(NAME,INSTR(NAME,'/')+1), -3, 3)) = 'doc' THEN '<table>' || '<tr><td><img src="#WORKSPACE_IMAGES#user_green_locked.gif"/></td></tr>' || '<tr><td style="text-align:center">' || SUBSTR(NAME,INSTR(NAME,'/')+1) name || '</td></tr></table>' WHEN LOWER(SUBSTR(SUBSTR(NAME,INSTR(NAME,'/')+1), -3, 3)) = 'xls' THEN '<table>' || '<tr><td><img src="#WORKSPACE_IMAGES#user_yellow.gif"/></td></tr>' || '<tr><td style="text-align:center">' || SUBSTR(NAME,INSTR(NAME,'/')+1) name || '</td></tr></table>' WHEN LOWER(SUBSTR(SUBSTR(NAME,INSTR(NAME,'/')+1), -3, 3)) = 'ppt' THEN '<table>' || '<tr><td><img src="#WORKSPACE_IMAGES#user_yellow.gif"/></td></tr>' || '<tr><td style="text-align:center">' || SUBSTR(NAME,INSTR(NAME,'/')+1) name || '</td></tr></table>' WHEN LOWER(SUBSTR(SUBSTR(NAME,INSTR(NAME,'/')+1), -3, 3)) = 'txt' THEN '<table>' || '<tr><td><img src="#WORKSPACE_IMAGES#user_yellow.gif"/></td></tr>' || '<tr><td style="text-align:center">' || SUBSTR(NAME,INSTR(NAME,'/')+1) name || '</td></tr></table>' WHEN LOWER(SUBSTR(SUBSTR(NAME,INSTR(NAME,'/')+1), -3, 3)) = 'gif' THEN '<table>' || '<tr><td><img src="#WORKSPACE_IMAGES#user_yellow.gif"/></td></tr>' || '<tr><td style="text-align:center">' || SUBSTR(NAME,INSTR(NAME,'/')+1) name || '</td></tr></table>' ELSE '<table>' || '<tr><td><img src="#WORKSPACE_IMAGES#user_red.gif"/></td></tr>' || '<tr><td style="text-align:center">' || SUBSTR(NAME,INSTR(NAME,'/')+1) name || '</td></tr></table>' END doc FROM con_doc_info) LOOP v_line := v_line || c.doc || '</td><td>'; v_counter := v_counter + 1; IF v_counter = v_rec_in_row THEN HTP.prn (v_line); HTP.prn ('</td></tr><tr><td>'); v_line := NULL; v_counter := 0; END IF; END LOOP; HTP.prn (v_line); HTP.prn ('</td></tr></table>'); END;
Any idea? Please help meHello Sonny_starck,
Remove the identifier 'name '.
of the ' | '. Name of substr (Name, InStr(Name,'/') + 1)"parts of your selection.
So just use «|» SUBSTR (NAME, INSTR(NAME,'/') + 1) ".
Which will probably solve your error ORA-06650Kind regards
Roelhttp://roelhartman.blogspot.com/
http://www.bloggingaboutoracle.org/
http://www.Logica.com/ -
reusable function within the vi
Hi all
I'm working on a façade with several controls on entry (the rings and text boxes). I want to put to the availability of the button proceed according to the values of input controls. My idea was to validate the entry when the value of one of the entrance control changes. Is it possible to write the code of validation only once and connect to several events (change of the value of the input controls)?
Thanks in advance,
If you use a structure for this event, you can have several events using the same case of event.
If this VI is used as a dialog box, you can configure several events to change the value from different sources of the user interface for the case of an event (use the blue + Add button event).
If this VI is a Subvi, you won't be able to work like this, as passing parameters does not raise the value change event...
Norbert
-
confusion on the stats from v$ sql
I'm trying to increase the performance of a quarter of the exadata machine rack and uses the table v$ sql to see what questions the front-end application is generating (done automatically) and sending it to oracle. I question the table v$ sql like this:
select sql_id, io_cell_offload_eligible_bytes qualifying, io_cell_offload_returned_bytes actual, round(((io_cell_offload_eligible_bytes - io_cell_offload_returned_bytes)/nullif(io_cell_offload_eligible_bytes,0))*100, 2) io_saved_pct, elapsed_time/1000000, first_load_time, application_wait_time/1000000, concurrency_wait_time/1000000, user_io_wait_time/1000000, plsql_exec_time/1000000, java_exec_time/1000000, cpu_time/1000000, rows_processed, sql_fulltext, sql_text from v$sql where io_cell_offload_returned_bytes > 0 and instr(sql_text, 'D1') > 0 and parsing_schema_name = 'DMSN' order by --(round(((io_cell_offload_eligible_bytes - io_cell_offload_returned_bytes)/nullif(io_cell_offload_eligible_bytes,0))*100, 2)) asc elapsed_time/1000000 DESC
Whats confusing for me, is that I see a row of the table like this:
SQL_ID QUALIFYING STAGE REAL IO_SAVED_PCT ELAPSED_TIME/1000000 FIRST_LOAD_TIME APPLICATION_WAIT_TIME/1000000 CONCURRENCY_WAIT_TIME/1000000 USER_IO_WAIT_TIME/1000000 PLSQL_EXEC_TIME/1000000 JAVA_EXEC_TIME/1000000 CPU_TIME/1000000 ROWS_PROCESSED SQL_FULLTEXT bvmtg9n1bss3r 181485174784 120788774976 33.44 5168.205681 2013-07-26/11: 42:53 5.481132 0.113112 3773.585818 0 0 1429.028 102401297 (HUGECLOB) 44y4dvhb12zc0 330356482048 110817408 99.97 3472.110958 2013-07-29/10: 11:35 2.359406 0.128388 3447.086174 0 0 21.973 275 (HUGECLOB) fssqzqq0tsffq 428624363520 7205116688 98,32 3099.086997 2013-07-20: 20: 51:28 0.058573 0.073064 2686.077653 0 0 361.081 40107806 (HUGECLOB) gyy3tk70t5h69 83012501504 70481653440 15.1 3050.021479 2013-08-01/10: 49:44 2.661973 0.000609 279.596557 0 0 2942.207 43649621 (HUGECLOB) fxazp767kzcan 3645325312 6389645208 -75.28 1477.232161 2013-08-05-09: 17:14 0.080002 0.000268 1374.649241 0 0 83.69 754293 (HUGECLOB) 0229k7cwq33aq 51346874368 3062262552 94.04 804.351766 2013-08-02/16: 01:34 1.880049 0,0019 693.156814 0 0 108.625 2005797 (HUGECLOB) the elapsed times are very long and my understanding is that it is the operating time from end to end for queries, is that correct.
But when I run these queries into a toad, the results come back in about a minute or two.
I have also noticed that most of the time is divided between USER_IO_WAIT_TIME and CPU_TIME, I think I understand what is CPU_TIME, but I wasn't quite able to understand what USER_IO_WAIT_TIME is the online documentation.
My question is, the elapsed time is really the end of the query execution time? If so, why do I see CBI? genetically different times when run the queries in Toad manually?
SELECT ELAPSED_TIME/EXECUTIONS AVG IN V$ SQL;
because elapsed_time is a cumulative value
-
Quiz Questions installed within the scrolling text box?
Hello
Is quick question, possible to enter the quiz questions in a text scrolling Interaction? Thanks for your time.
-Brett H.
I don't think it's possible, because the scrolling text is an Interaction, and you have almost no control over it. Certainly not the questions by default, which is totally excluded.
Maybe you are looking for
-
Hello Following a recent download of a defrag program I did not notice that he put in bitable.com. This page (direct access to social networks sites, Google YT etc ) has now displaced my dedicated Home Page which is Google Actualities. I cannot find
-
Samsung SEE II Android Smartphone
Is it possible to synchronize the phone numbers AND addresses on this phone to your computer? Whenever I move my SIM card from one phone to another, I lose the address because the SIM card keeps only the numbers...
-
WRT120N - how to get static IP and DHCP to work together
I have a few features on my net that must be static and other who work best as dynamic dhcp provided. How to configure the router to never give a static IP dhcp, preferably even IP addresses if the static IP device is OFF right now? It would be almos
-
want to 23 powers on, fan spinns full speed but nothing else
Any ideas? Ive tried looking here but can't find the right strings, or am I the only one to have this, which I doubt... TIA
-
Can I delete folder AppData Roaming?
Original title: AppData Roaming folder I moved (copy) the AppData Roaming folder on an external drive using the Windows tool in the Panel properties (location tab). Can I now he remove it from my C drive? It takes 10 GB of space and I am running low