SQL function that just check some data exist?
Is there in oracle 11g R2, any function that would check just a few criteria filtering for existence, without go through the db all?for example, a query:
select 1 dummy from myTable where criteria='VALUE';
trace is:Execution Plan
----------------------------------------------------------
Plan hash value: 2260399482
------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 10 | 3 (0)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| ARCHIVE_TABLES | 1 | 10 | 3 (0)| 00:00:01 |
------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("TABLE_NAME"='TRANSAKCIJE')
It seems so, there is no way to create a query that will be internally just check to match 1...or am I wrong?
(using index is not an option...)
I also tried to use / * + FIRST_ROWS * / tip, but there is no difference...
example that I gave is just an example
Published by: 846417 on April 15, 2011 04:26
Dear Sir
Something like that?
mhouri.world> SELECT 1
2 FROM dual
3 where exists (select null
4 from emp
5 where deptno in (10, 20));
1
----------
1
Elapsed: 00:00:00.01
mhouri.world> start dispcursor
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID 5akw2rf979zus, child number 0
-------------------------------------
SELECT 1 FROM dual where exists (select null from emp
where deptno in (10, 20))
Plan hash value: 3883502343
-----------------------------------------------------------------------------------------
| Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers |
-----------------------------------------------------------------------------------------
|* 1 | FILTER | | 1 | | 1 |00:00:00.01 | 1 |
| 2 | FAST DUAL | | 1 | 1 | 1 |00:00:00.01 | 0 |
| 3 | INLIST ITERATOR | | 1 | | 1 |00:00:00.01 | 1 |
|* 4 | INDEX RANGE SCAN| EMP_FK_I | 1 | 3 | 1 |00:00:00.01 | 1 |
-----------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter( IS NOT NULL)
4 - access(("DEPTNO"=10 OR "DEPTNO"=20))
and so for your condition
select 1 dummy from dual
where exists (select null
from myTable
where criteria='VALUE');
Best regards
Mohamed Houri
Tags: Database
Similar Questions
-
PL/SQL functions as LOV to use in another display object
Hello
We had a custom search to extract data from a display object and the data displayed as a Table of ADF. Now, there are few requests for searches on this report. Go see criteria and Panel request if we allow saved search. But the fields used in the research are going through a lot of logic and thus the PL/SQL functions are implemented. We used to call these functions and lists separated by commas and then divided the list into individual elements and put in the component "select options".
The value (String) returned by the pl/sql function is something like - APAC, EMEA, NORTH AMERICA, FDA
I am creating a LOV based on SQL-query "Select getRegions() from dual;
Now, I want the list separated by commas to divide so that I could use this LOV in an another view and try the display criteria and saved searches.
I tried to assign as LOV just to check and the criteria drop-down view for region displays same value as single element - "APAC, EMEA, NORTH AMERICA, LAD."
I want it to be 4 separate - elements
APAC
EMEA
NORTH AMERICA
DVL
Is there anyway to achieve this?
Or better is at - it another way to do this (maybe I'm wrong)
Thank you.
JDev: 11.1.2.4
Instead of a programmatic VO of PL/SQL, I found sometimes easier to write PL/SQL functions that return a table - need to CREATE a TYPE for the data items to be returned and a TYPE of TABLE IMBRIQUE tabular form of the first kind. The function returns the type of table, and can even be a PIPElined table function. Then I create a VO with the following text:
SELECT * from TABLE (my_function_returning_table)
The function can even take parameters, which you fill with variable BIND your VO.
-
Function that returns only numbers
Is it possible to have a SQL function that returns only numbers in a varchar?
Example:
My PHONE_NUMBER table contains a field with a phone number in VARCHAR2, it can contain:
1-888-444-5555 or (514) 444-6666 or 514-222-4444 ext: 100
I want to have a fuction which back me:
18884445555 and 5144446666...
Thanks for the helpHello
For a copy of the string s with everything except the numbers (0-9), was deleted:
REGEXP_REPLACE ( s , '[^0-9] )
The expression above will work in Oracle 10 and higher.
In any version, you can use TRANSLATE to remove the numbers, then reuse TRANSLATE to remove these characters from the s.TRANSLATE ( s, , '0' || TRANSLATE ( s , 'A0123456789' , 'A' ) , '0' )
-
Allowing access only through a PL/SQL function
What is the technique of letting a user to do something by a PL/SQL function that would normally not have the privilege to do so, without granting the possibility to do outside the PL/SQL function?
I have a need to allow a user to change the global_name of the database, in the resolution of ORA-02082 errors. In short, the product using Oracle (we can not change code) loopback database links, and the only way to drop them (according to the Oracle support) is to temporarily change the global_name, drop the link and change the global_name return.
This happens on a semi-regular basis, so rather than having to involve a DBA, I favor.
My thought was to create a PL/SQL procedure that performs the Rename/move/rename. I don't want the user to be able to change the global_name of DB to what he wants, but I want him to have the possibility to change through the PL/SQL procedure at will.
My question is, how to do this without allowing the user to update on sys.global_name?
Let's see:
(1) create a role (say LOOPBACK_DBLINK_DROPPER)
(2) create a procedure (say LOOPBACK_DBLINK_DROP) makes the Rename/move/rename
(3) grant and then execute the procedure to the role
(4) ??? .. .the I need to give an update on sys.global_name for the role. But if I then assign the role to a user, is not that means he can also update sys.global_name on its own without using the procedure, because it would have the sys.global_name privilege update?Create the schema belonged procedure that has the necessary privileges.
GRANT EXECUTE on LOOPBACK_DBLINK_DROP to NON_PRIV_USERThat's all!
-
Chain replication using a sql function...
Hello
Is there a sql function that reproduces a string given so many times that appears in a parameter...?
For example: String-> test
Select < sql_function > ('test', 3) double
-> testtesttest
Note: I use Oracle10g v.2
Thank you
SIMWhat about a SQL?
satyaki> satyaki>select * from v$version; BANNER ---------------------------------------------------------------- Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod PL/SQL Release 10.2.0.3.0 - Production CORE 10.2.0.3.0 Production TNS for 32-bit Windows: Version 10.2.0.3.0 - Production NLSRTL Version 10.2.0.3.0 - Production Elapsed: 00:00:00.08 satyaki> satyaki> satyaki>select DBMS_XMLGEN.getxmltype ('SELECT '||chr(39)||'&str'||chr(39)||' cola FROM dual connect by rownum<='||&num).EXTRACT('//text()') res 2 from dual; Enter value for str: satyaki Enter value for num: 1 old 1: select DBMS_XMLGEN.getxmltype ('SELECT '||chr(39)||'&str'||chr(39)||' cola FROM dual connec new 1: select DBMS_XMLGEN.getxmltype ('SELECT '||chr(39)||'satyaki'||chr(39)||' cola FROM dual con RES ---------------------------------------------------------------------------------------------------- satyaki Elapsed: 00:00:00.07 satyaki>/ Enter value for str: satyaki Enter value for num: 2 old 1: select DBMS_XMLGEN.getxmltype ('SELECT '||chr(39)||'&str'||chr(39)||' cola FROM dual connec new 1: select DBMS_XMLGEN.getxmltype ('SELECT '||chr(39)||'satyaki'||chr(39)||' cola FROM dual con RES ---------------------------------------------------------------------------------------------------- satyakisatyaki Elapsed: 00:00:00.03 satyaki> satyaki>/ Enter value for str: satyaki Enter value for num: 3 old 1: select DBMS_XMLGEN.getxmltype ('SELECT '||chr(39)||'&str'||chr(39)||' cola FROM dual connec new 1: select DBMS_XMLGEN.getxmltype ('SELECT '||chr(39)||'satyaki'||chr(39)||' cola FROM dual con RES ---------------------------------------------------------------------------------------------------- satyakisatyakisatyaki Elapsed: 00:00:00.02 satyaki> satyaki>/ Enter value for str: satyaki Enter value for num: 5 old 1: select DBMS_XMLGEN.getxmltype ('SELECT '||chr(39)||'&str'||chr(39)||' cola FROM dual connec new 1: select DBMS_XMLGEN.getxmltype ('SELECT '||chr(39)||'satyaki'||chr(39)||' cola FROM dual con RES ---------------------------------------------------------------------------------------------------- satyakisatyakisatyakisatyakisatyaki Elapsed: 00:00:00.14
Kind regards.
LOULOU
Published by: Satyaki_De on September 27, 2008 14:10
-
How to identify columns that have the same data in a SQL query or function?
Deal all,
How to identify columns that have the same data in a SQL query or function? I have the sample data as below
!DEPT_ID EMP_ID Come on CITY STATE COUNTRY 1 1 1 June 1983 DELHI HUMAN RESOURCES India 1 2 18 January 1987 DELHI HUMAN RESOURCES India 1 3 28 November 1985 DELHI HUMAN RESOURCES India 1 4 4 June 1985 DELHI HUMAN RESOURCES India 2 5 5 June 1983 MUMBAI HD India 2 6 6 June 1983 MUMBAI HD India 2 7 7 June 1983 MUMBAI HD India . 19832 8 8 Jun MUMBAI HD India . June 19833 9 9 GURGAON DL India 3 10 10 June 1983 GURGAON DL India Now, I want to Indify columns that have the same data for the same Department ID.
Is it possible in sql unique or do I have to write the function for this? Pls Help how to write?
Thanks in advance.
You can try this?
WITH T1)
DEPT_ID, EMP_ID, DATE OF BIRTH, CITY, STATE, COUNTRY
), ()
SELECT 1, 1, TO_DATE('1.) June 1983', 'JJ. LUN. (YYYY'), 'DELHI', 'HR', 'INDIA' OF THE DUAL UNION ALL
SELECT 1, 2, TO_DATE('18.) January 1987', 'JJ. LUN. (YYYY'), 'DELHI', 'HR', 'INDIA' OF THE DUAL UNION ALL
SELECT 1, 3, TO_DATE('28.) November 1985', 'JJ. LUN. (YYYY'), 'DELHI', 'HR', 'INDIA' OF THE DUAL UNION ALL
SELECT 1, 4, TO_DATE('4.) June 1985', 'JJ. LUN. (YYYY'), 'DELHI', 'HR', 'INDIA' OF THE DUAL UNION ALL
SELECT 2.5, TO_DATE('5.) June 1983', 'JJ. LUN. (YYYY'), 'BOMBAY', 'HD', 'INDIA' OF THE DUAL UNION ALL
SELECT 2.6, TO_DATE('6.) June 1983', 'JJ. LUN. (YYYY'), 'BOMBAY', 'HD', 'INDIA' OF THE DUAL UNION ALL
SELECT 2.7, TO_DATE('7.) June 1983', 'JJ. LUN. (YYYY'), 'BOMBAY', 'HD', 'INDIA' OF THE DUAL UNION ALL
SELECT 2.8, TO_DATE('8.) June 1983', 'JJ. LUN. (YYYY'), 'BOMBAY', 'HD', 'INDIA' OF THE DUAL UNION ALL
SELECT 3, 9, TO_DATE('9.) June 1983', 'JJ. LUN. (YYYY'), 'GURGAON', 'DL', 'INDIA' OF THE DUAL UNION ALL
SELECT 3.10, TO_DATE('10.) June 1983', 'JJ. LUN. (YYYY'), 'GURGAON', 'DL', 'INDIA' OF THE DOUBLE)
SELECT DEPT_ID,
RTRIM (XMLAGG (XMLELEMENT(A,VALS||',')). Extract ('//Text ()'), ',') COLUMNS_WITH_DUPLICATE
DE)
SELECT * FROM)
SELECT DEPT_ID,
EMP_ID,
Date of birth
CITY,
STATE,
COUNTRY
DE)
SELECT DEPT_ID,
EMP_ID,
Date of birth
CITY,
STATE,
COUNTRIES,
COUNT (*) OVER(PARTITION BY DEPT_ID ORDER BY EMP_ID DESC,DOB DESC,CITY DESC,STATE DESC, COUNTRY DESC) RN
DE)
SELECT DEPT_ID,
CASE WHEN(CEID>1) AND THEN 'YES' ELSE 'NO' END AS EMP_ID.
CASE WHEN(CDOB>1) THEN 'YES' ELSE 'NO' END AS DATE OF BIRTH,
CASE WHEN(CCITY>1) AND THEN 'YES' ELSE 'NO' END AS CITY.
CASE WHEN(CSTATE>1) AND THEN 'YES' ELSE 'NO' END AS STATE.
CASE WHEN(CCOUNTRY>1) THEN 'YES' ELSE 'NO' END AS A COUNTRY
DE)
SELECT DISTINCT
DEPT_ID,
CEID,
CDOB,
CITY,
CSTATE,
CCOUNTRY
DE)
SELECT DEPT_ID,
COUNT (*) TO THE CEID (DEPT_ID PARTITION, EMP_ID),.
COUNT (*) ON CDOB (DEPT_ID SCORE, DATE OF BIRTH),
COUNT (*) ON THE CITY (DEPT_ID PARTITION, CITY),
COUNT (*) ON CSTATE (DEPT_ID PARTITION, STATE).
COUNT (*) ON CCOUNTRY (DEPT_ID, COUNTRY PARTITION)
FROM T1)))
WHERE RN = 1)
UNPIVOT (CLO FOR (VALS) IN (EMP_ID, DATE OF BIRTH, CITY, STATE, COUNTRY)))
WHERE COLS = "YES".
DEPT_ID GROUP;
OUTPUT:
DEPT_ID COLUMNS_WITH_DUPLICATE
--------- ------------------------1 CITY, COUNTRY, STATE
2 CITY, COUNTRY, STATE
3 CITY, COUNTRY, STATEPost edited by: Parth272025
-
How can I check for dates that are the same for today.
If I have a bunch of dates in a datetime colum. How can I check for dates that are the same for today.
"For example, this value of days would be ' #dateFormat (now (),"mm dd yyyy") #
The best I could come up with was:
Select * from data where data.userID =
2635 AND
"Convert (varchar, dateAdded, 101) = ' #dateFormat (now (),"mm dd yyyy") #
How can I get this to work smart peeople :)It is best to make the comparison on the datetime values. One technique is to get the current date at midnight. Then add one day to get tomorrow's date. In your sql query finds all values is greater than or equal to today and less than tomorrow.
One solution is to do everything in MS SQL
WHERE the dateAdded > = convert (datetime, convert (varchar, getdate(), 112), 112)
AND dateAdded = dateAdd (d, 1, convert (datetime, convert (varchar, getdate(), 112), 112))Another option could be to use CF to calculate dates:
WHERE the dateAdded > =.
AND dateAdded<> -
function/SQL to get the next weekend date of SUNDAY, in light of the current sysdate
Hi all
someone at - it a reliable piece of SQL or the function that takes the current SYSDATE as a parameter and returns the next date available weekend (SUNDAY)
So for example if it is adopted as of today 01/07/2009 (Wednesday) it returns data 07/05/2009, which is the Date of Sunday following.
Even if I went to Sunday 07/05/2009, it would go back the date 07/12/2009, which is this Sunday.
Any help in advance apppreciated!
Kind regards
Satnamselect next_day(sysdate, 'SUNDAY') from dual
Good luck
-
How can I get rid of a green field with a white check mark in that box covers some of my photos and on the windows for firefox icon. Edit
Hello
I want to thank everyone for the information, I had to uninstall Norton in order to get the green boxes deleted. Thank you once again problem fixed. -
Is it CVI API functions that search fo a path given of him exist file? like C ++ Builder 'DirectoryExists', I tried 'FileExists', but unnecessary
-
I can't get the automatic updates on my samsung jack sgh-i616.
"Connection to the update server is not available. "Check your data connection settings and make sure that the device date and time are correct.
RESULT CODE: 80072ee7
-It is a windows mobile 6.1
Thank you very much! = DAs a guide.
This error code translates ERROR_INTERNET_CANNOT_CONNECT.
You may encounter temporary connection related errors when you use Windows Update or Microsoft Update to install updates
http://support.Microsoft.com/kb/836941Harold Horne / TaurArian [MVP] 2005-2011. The information has been provided * being * with no guarantee or warranty.
-
Hello, I want to cancel the subscription which I just contracted to date. It is a software that allows to make PDF to a document. DOC. My Email: < kglad deleted >
-
Go to a function that returns a Boolean
Short version of the question: Boolean values can be returned by a pl/sql function?
I've implemented a short function which returns a Boolean value; When I compile it I get an error:
Error report:
ORA-06550: line 5, column 32:
PLS-00382: expression is of the wrong type
ORA-06550: line 6, column 4:
PLS-00306: wrong number or types of arguments in the call to "PUT_LINE '.
ORA-06550: line 6, column 4:
PL/SQL: Statement ignored
06550 00000 - "line %s, column % s:\n%s".
* Cause: Usually a PL/SQL compilation error.
* Action:
The closest, I appealed
RETURN sys.diutil.bool_to_int (< foo >);
and then a caller script can call
sys.diutil .int_to_bool (< bar >);
at least this way there is no verification of the Boolean value of 'manual '. Is it really the only way to return / call a Boolean?
Thank you
Chris
EDIT
I was aware of the fact I had not provided examples of code - and was just one question fairly open. I hope that this example will show what does not work!
I have a function that returns a Boolean value:
create or replace
FUNCTION myFunc (s_in IN VARCHAR2) RETURN a Boolean value
IS
s_out BOOLEAN: = TRUE;
BEGIN
RETURN s_out;
END FUNCTION3;
I try and call the function in the following script:
DECLARE
s_in varchar2 (20): = "Hello";
s_out boolean;
BEGIN
SELECT myfunction (s_in) INTO s_out FROM DUAL;
END;
That's when I get the error. But sorry, I was looking for too many error messages! I have worked that the one I posted above is because put_line can accept only strings and numbers not Boolean, the mistake that this function returns is:
ORA-06550: line 5, column 32:
PLS-00382: expression is of the wrong type
ORA-06550: line 5, column 11:
PLS-00382: expression is of the wrong type
06550 00000 - "line %s, column % s:\n%s".
* Cause: Usually a PL/SQL compilation error.
* Action:
However, I suppose that the comment of Frank Kulash is perhaps the reason why I see this?
Post edited by: 2922851
Hi, Chris,.
2922851 wrote:
Short version of the question: Boolean values can be returned by a pl/sql function?
Sure. If you are having problems, post your code (both the function and some PL/SQL that calls it).
The BOOLEAN data type exists only in PL/SQL, not in SQL, so if the function returns a BOOLEAN value, then you can't call it in a SQL statement, even if this SQL statement is used within PL/SQL. For this reason, a lot of guys write functions that return a NUMBER (1 or 0) or a string (' t ' or 'F') rather than return a BOOLEAN value.
I've implemented a short function which returns a Boolean value; When I compile it I get an error:
Error report:
ORA-06550: line 5, column 32:
PLS-00382: expression is of the wrong type
ORA-06550: line 6, column 4:
PLS-00306: wrong number or types of arguments in the call to "PUT_LINE '.
ORA-06550: line 6, column 4:
PL/SQL: Statement ignored
06550 00000 - "line %s, column % s:\n%s".
* Cause: Usually a PL/SQL compilation error.
* Action:
This error indicates a problem calling put_line; It has nothing to do with what returns the function.
-
PL/SQL function to calculate the non-working days
Hello
I have the following pl/sql function which generates a number of days between two selected dates (i.e. excluding weekends). However, I also need to exclude specific holidays - day of Christmas etc. These holiday dates are stored in a table in our database (11 GR 2) called "HOLIDAY".
How can I integrate the holidays which is held in the table of holidays in the following query to exclude these dates as well? I know how to write a separate funtion pl/sql for a number of days between two dates using SELECT... BUT I can't work out how to bring together them in a single query.
Could someone show me how with the pl/sql / dates below please?
Example of HOLIDAY table below.
Thank you!
TP
create or replace function WORKING_DAYS (pi_start_date in date, pi_end_date in date) return integer is v_start_date date :=pi_start_date; v_end_date date:=pi_end_date; v_count integer:=0; begin while v_start_date <= v_end_date loop if to_char(v_start_date,'D') not in ('6','7') then v_count := v_count+1; end if; v_start_date:=v_start_date+1; end loop; return v_count; end;
(select '10-Apr-2013' as NWD from dual union all select '06-May-2013' from dual union all select '27-May-2013' from dual union all select '26-Aug-2013' from dual union all select '26-Dec-2013' from dual union all select '25-Dec-2013' from dual union all select '01-Jan-2014' from dual union all select '18-Apr-2014' from dual union all select '21-Apr-2014' from dual union all select '05-May-2014' from dual union all select '26-May-2014' from dual union all select '25-Aug-2014' from dual union all select '25-Dec-2014' from dual union all select '26-Dec-2014' from dual) HOLIDAYS
Hello
the link is on MOSC, not OTN... Here's a copy:
This function calculates the number of days between two dates, ignoring weekends and holidays (if requested and if the holidays are stored in a table)
I give an example of table 'public_holiday' with sample data, but users must ensure that their table contains the relevant data (all holidays within the maximum range of use of the service)
CREATE TABLE public_holiday (calendar_day, DATE, text VARCHAR2 (30));
FUNCTION to CREATE or REPLACE nb_days (p_date_from IN DATE
p_date_to DATE by DEFAULT TRUNC (sysdate)
, p_public_holidays in CHAR DEFAULT 'Y '.
) RETURN NUMBER
DEFINE AUTHID
AS
/*********************************************************************/
/ * Author: Bruno Vroman * /.
/ * Created: 23-AUG-2012 * /.
/ * Last updated: 23-AUG-2012 * /.
/ * Object: to calculate the number of days between 2 dates, to the exclusion of * /.
/ * Saturday and Sunday, but also "holidays" If the * /.
/ * argument 'p_public_holidays' = 'Y ' * /.
/ * Support: p_date_from<= p_date_to ="">=>
/ * component ' hour min dry "ignored (just counting days) * /.
/* First step: */
/ * the calendar days between 2 days * /.
/ Remove 2 days for each "week" and 0 or 1 extra day * /.
/ * function to a condition "complex" mix day of first week * /.
/ * and the number of days when full remaining weeks are removed * /.
/ * (set up once for all, for example if there is 3 days and the * /)
(/ * first day is a Thursday, there is 1 "Sat/Sun" to subtract) * /.
/ * Second step: If 'p_public_holidays' = 'Y': other * /.
/ * days, do not count holidays. */
/ Holiday everyday are defined in a table "public_holiday" * /.
/ * Note: there may be holidays defined on Saturday/Sunday. */
/*********************************************************************/
l_result NUMBER;
l_from DATE;
l_to DATE;
l_case tank (4);
BEGIN
l_from: = TRUNC (p_date_from);
l_to: = TRUNC (p_date_to);
l_case: = TO_CHAR (l_from, 'Dy', 'NLS_DATE_LANGUAGE = English').
To_char (MOD (l_to - l_from + 1, 7));
l_result: = l_to - l_from + 1
-TRUNC ((l_to-l_from + 1) / 7) * 2
-CASE
WHEN l_case IN ('Mon6', 'Tue5', 'Wed4', 'Thu3', 'Fri2'
, "Sat1", "Sun1", "Sun2', 'Sun3", "Sun4".
, "Sun5', 'Sun6.
)
THEN 1
WHEN l_case IN ('Tue6', 'Wed5', 'Wed6', 'Thu4', "Thu5"
, 'Thu6', 'Fri3', 'Fri4', 'Fri5', 'Fri6 '.
, "Sat2", "Sat3', 'Sat4', 'Sat5", "Sat6.
)
THEN 2
0 OTHERWISE
END
;
IF SUPERIOR (p_public_holidays) = "Y".
THEN
SELECT l_result - COUNT (*)
IN l_result
OF public_holiday p
WHERE p.calendar_day > = l_from
AND p.calendar_day<=>=>
AND SUBSTR (TO_CHAR (p.calendar_day
, "Dy".
'NLS_DATE_LANGUAGE = English'
)
, 1, 1 ) != 'S'
;
END IF;
RETURN l_result;
EXCEPTION
WHILE OTHERS
THEN
DBMS_OUTPUT. Put_line (' CTF nb_days (' |))
To_char (p_date_from, "MON-DD-YYYY"). ', ' ||
To_char (p_date_to, "MON-DD-YYYY"). ', ' ||
p_public_holidays | ' ) : ' || SQLERRM
);
LIFT;
END nb_days;
/
REM
REM example:
REM A) fill out the 'public_holidays '.
REM
TRUNCATE TABLE public_holiday;
INSERT INTO public_holiday VALUES (DATE ' 2012-01-01', ' new year (a Sunday)');
INSERT INTO public_holiday VALUES (DATE '' 2012-01-03, "for example");
REM (insert other days...)
COMMIT;
Call the function for some pairs of dates of REM B)
REM nb1: remove only Sat/Sun
REM nb2: also remove holidays
REM
ALTER SESSION SET nls_date_format ='Dy DD-MON-YY';
WITH some_dates AS
(SELECT DATE ' 2011-12-29'd dual FROM
UNION ALL SELECT DATE ' 2012-01-08' FROM dual
UNION ALL SELECT DATE ' 2012-01-10' FROM dual
)
SELECT d1.d 'FROM '.
, d2.d ' to THE '.
, nb_days (d1.d, d2.d, ' don't) nb1
, nb_days (d1.d, d2.d, 'Y') nb2
OF some_dates d1
some_dates d2
WHERE d1.d<=>=>
ORDER BY nb1, nb2, d1.d
;
GO TO NB1 NB2
------------- ------------- ---- ----
Monday, January 8, 12 Monday, January 8, 12 0 0
Friday, December 29, 11 Friday, December 29, 11 1 1
Wednesday, January 10, 12 Wednesday, January 10, 12 1 1
Monday, January 8, 12 Wednesday, January 10, 12 2 2
Friday, December 29, 11 Monday, January 8, 12 7 6
Friday, December 29, 11 Wednesday, January 10, 12 9 8
Hope that this could be useful, but note that this code has not been completely tested, so check and test before you trust it (in the case of any questions, please post a comment)
Bruno Vroman.
Best regards
Bruno
-
global variable functional to read and write data from and to the parallel loops
Hello!
Here is the following situation: I have 3 parallel while loops. I have the fire at the same time. The first loop reads the data from GPIB instruments. Second readers PID powered analog output card (software waveform static timed, cc. Update 3 seconds interval) with DAQmx features. The third argument stores the data in the case of certain conditions to the PDM file.
I create a functional global variable (FGV) with write and read options containing the measured data (30 double CC in cluster). So when I get a new reading of the GPIB loop, I put the new values in the FGV.
In parallel loops, I read the FGV when necessary. I know that, I just create a race condition, because when one of the loops reads or writes data in the FGV, no other loops can access, while they hold their race until the loop of winner completed his reading or writing on it.
In my case, it is not a problem of losing data measured, and also a few short drapes in some loops are okey. (data measured, including the temperature values, used in the loop of PID and the loop to save file, the system also has constants for a significant period, is not a problem if the PID loop reads sometimes on values previous to the FGV in case if he won the race)
What is a "barbarian way" to make such a code? (later, I want to give a good GUI to my code, so probably I would have to use some sort of event management,...)
If you recommend something more elegant, please give me some links where I can learn more.
I started to read and learn to try to expand my little knowledge in LabView, but to me, it seems I can find examples really pro and documents (http://expressionflow.com/2007/10/01/labview-queued-state-machine-architecture/ , http://forums.ni.com/t5/LabVIEW/Community-Nugget-2009-03-13-An-Event-based-messageing-framework/m-p/... ) and really simple, but not in the "middle range". This forum and other sources of NEITHER are really good, but I want to swim in a huge "info-ocean", without guidance...
I'm after course 1 Core and Core 2, do you know that some free educational material that is based on these? (to say something 'intermediary'...)
Thank you very much!
I would use queues instead of a FGV in this particular case.
A driving force that would provide a signal saying that the data is ready, you can change your FGV readme... And maybe have an array of clusters to hold values more waiting to be read, etc... Things get complicated...
A queue however will do nicely. You may have an understanding of producer/consumer. You will need to do maybe not this 3rd loop. If install you a state machine, which has (among other States): wait for the data (that is where the queue is read), writing to a file, disk PID.
Your state of inactivity would be the "waiting for data".
The PID is dependent on the data? Otherwise it must operate its own, and Yes, you may have a loop for it. Should run at a different rate from the loop reading data, you may have a different queue or other means for transmitting data to this loop.
Another tip would be to define the State of PID as the default state and check for new data at regular intervals, thus reducing to 2 loops (producer / consumer). The new data would be shared on the wires using a shift register.
There are many tricks. However, I would not recommend using a basic FGV as your solution. An Action Engine, would be okay if it includes a mechanism to flag what data has been read (ie index, etc) or once the data has been read, it is deleted from the AE.
There are many ways to implement a solution, you just have to pick the right one that will avoid loosing data.
Maybe you are looking for
-
PowerPoint 2010 slide show does not appear in NetMeeting
We migrated to Office 2010 and now when we try to make presentations PowerPoint (slide show) via Netmeeting w / remote employees, they can't see the presentation - it shows just like a black screen. We cannot use the broadcast feature because a lot
-
VAIO Duo 11 charges slow reeeallyy
If anyone else has noticed this? I admit that I only got the Duo the other day, maybe I'm breaking in. It took almost all day for my second battery... I'll see if I can get a program to actually record how long it takes.
-
Problem update the Atheros wifi in my windows vista
I have a Toshiba Sat with Vista. Whenever windows update my atheros gel to start the computer. I had to do a full restore twice in the past week. Can anyone help?
-
Please confirm Inspiron Integrated Network interface dead
Last night we had a lightning strike near, I grilled my Inspiron 660 built-in adapter Mbps ethernet 10/100/1000. I just need a confirmation that I am wrong and that the only option is to buy a new adapter. Evidence: 1. There is no link light 2. the
-
Problem with the Plagin shop - merchium.ru
I want to intagrate merchium.ru shop plugin on the web site, but it's not working. Problem of Muse.< div class = "tygh" id = "tygh_container" >< / div >< script type = "text/javascript" data-no-reporter >(function() {}var url = "https:" == document.l