PL/SQL :: Set Boolean Flag To True If Hire_date Is Greater Than 5 Years
Dec 27, 2012
For Just learning purpose This is an example found in text book but while i try to execute it fails..I am trying to set Boolean flag to true if the hire_date is greater than 5 years otherwise boolean flag to false
DELARE
v_Hire_date date :='12-Dec-2005';
v_five_years BOOLEAN;
BEGIN
IF
[code].....
View 17 Replies
ADVERTISEMENT
Oct 7, 2011
EMP_ID IN_DATE QTY2
1070410/6/11 6:00 AM
1070410/6/11 3:00 PM
1070410/6/11 9:00 PM
1070410/7/11 6:00 AM
1070410/7/11 3:00 PM
1070410/7/11 9:00 PM
1070510/7/11 6:00 AM
1070510/7/11 3:00 PM
1070510/7/11 9:00 PM
following is the table where every employee have 3 records we need to put the flag datewise and employee id wise minimum in_date always be set to 1 and remaining 2 maximum dates for each employee date wise always set to 2 in qty2 field.
Output requirement is as follows:
EMP_ID IN_DATE QTY2
1070410/6/11 6:00 AM 1
1070410/6/11 3:00 PM 2
1070410/6/11 9:00 PM 2
1070410/7/11 6:00 AM 1
1070410/7/11 3:00 PM 2
1070410/7/11 9:00 PM 2
1070510/7/11 6:00 AM 1
1070510/7/11 3:00 PM 2
1070510/7/11 9:00 PM 2
View 4 Replies
View Related
Aug 28, 2012
CREATE OR REPLACE FUNCTION is_overdue (due_date IN DATE,paid_date IN DATE)
RETURN BOOLEAN
IS
days_between NUMBER (2) := due_date - paid_date;
BEGIN
[code]......
When i try using this compilation, i am getting error for this program:
SQL> begin
2 dbms_output.put_line(is_overdue('07-nov-1987','01-aug-2012'));
3 end;
4 /
dbms_output.put_line(is_overdue('07-nov-1987','01-aug-2012'));
*
ERROR at line 2:
ORA-06550: line 2, column 7:
PLS-00306: wrong number or types of arguments in call to 'PUT_LINE'
ORA-06550: line 2, column 7:
PL/SQL: Statement ignored
To get output for this program? Show me how to compile.
View 24 Replies
View Related
Dec 1, 2012
I'm trying to create a table 'a' with column name as 'flag' and datatype as 'boolean' ie. create table a(flag boolean);
is it possible in sql or pl/sql in oracle?
If its possible to create a table and also let me now inserting row and what boolean should return.
View 1 Replies
View Related
May 29, 2012
I want to display Boolean value of a variable in DBMS Print statement. I am able to do it by using simple if condition checking .How to print the value of Boolean variable directly ?
SQL> declare
2 boo boolean := true;
3 begin
4
5 if boo then
6 dbms_output.put_line('boolean variable value TRUE by checking if condition ');
[code]....
ORA-06550: line 9, column 24:
PLS-00306: wrong number or types of arguments in call to '||'
ORA-06550: line 9, column 3:
PL/SQL: Statement ignored
View 6 Replies
View Related
Mar 12, 2013
Application Express 4.1.1.00.23 ( plus all earlier versions that I've ever used)
When using the wizard to create a Validation of type "PLSQL Function returning Boolean", why is it mandatory to enter a value in the text field "Error Message" on the screen that follows? This message is never used as the message actually displayed comes from a PLSQL return statement.
View 5 Replies
View Related
Jul 6, 2012
oracle version 11gr2.In the below sample data column a,b if there is Two (2) consecutive numbers are transposed in column B from A it should return string 'true'.
with t as
(
select '123456789' a ,'123476581' b from dual
union all
select '123456789' ,'123465789' from dual
union all
select '332211' ,'332121' from dual
union all
[code]....
View 3 Replies
View Related
Jul 6, 2012
oracle version 11gr2.
In the below sample data column a,b if there is Two (2) consecutive numbers are transposed in column B from A it should return string 'true'.
with t as
(
select '123456789' a ,'123476581' b from dual
union all
select '123456789' ,'123465789' from dual
union all
[Code]....
i need a output as below.
a b val
123456789 123476581 FALSE
123456789 123465789 TRUE
332211 332121 TRUE
54321 54312 TRUE
78901 79801 TRUE
65432 63452 FALSE
View 29 Replies
View Related
Jan 20, 2010
What do you think of this 11.2 parameter? It can give some pretty weird results.
SQL> create tablespace ts1 datafile size 10m;
Tablespace created.
SQL> create table t1 (c1 date) tablespace ts1;
Table created.
SQL> drop tablespace ts1;
Tablespace dropped.
SQL> insert into t1 values(sysdate);
insert into t1 values(sysdate)
[code]...
View 5 Replies
View Related
Apr 12, 2011
I am unable to hide or make visible a menu item dynamically. I want to show a menu to a bunch of employees only.
I have tried:
On the menu properties, I have done:
Physical-> visible : No
functional -> visible in Menu: No
(Have tried different combinations too)
On the form where this menu is attached, I have written trigger new form instance:
SET_MENU_ITEM_PROPERTY('mymenu.menu_name',visible,PROPERTY_TRUE);
Its working fine when I am trying to enable or disable the same but I have to do it the desired way.
View 4 Replies
View Related
Dec 22, 2010
I have to run a resource extensive SQL. It utilizes CPU to a great extent. I've created a new user just to run this particular report. I need to ensure that this particular user doesn't uses more CPU.
Hence, I need to generate an alarm (email) only if a threshold is exceeded for a certain period of time (above x% for y minutes),(example more than 80% for 10 min.), so that I can either kill the process or continue running it depending on CPU usage.
Can I do it using scripts or OEM. I couldn't find any specific metrics to do it in latter. (I'd prefer scripts though. )
My system details are as follows:
1. Database: Oracle 10g R2
2. Unix: Sun OS 5.10
View 2 Replies
View Related
Sep 17, 2013
I am not a DBA, we are using Oracle 10g DB for our PLM applictaion Enovia, we are now trying to do 4GT in our windows 2003 server where our DB kept, while reading articles about this. we are informed that /LARGEADDRESSAWARE (IMAGE_FILE_LARGE_ADDRESS_AWARE) flag needed to be set to True in the application (here it is Oracle) to use more than 2GB in the RAM.
So My question is "Whether the corresponding flag is set to TRUE or not in Oracle 10g"? Is there any way to check that?"
View 1 Replies
View Related
Jun 7, 2012
I have records like the following
Program_Name Effective_Date Valid_Flag
ABCD 2/10/2012 N
ABCD 2/14/2012 N
ABCD 2/20/2012 Y
ABCD 3/01/2012 N
ABCD 3/10/2012 N
[Code]...
I have to write a select statement to to keep the first record and then pull only the records when the Valid_Flag changed. The result set should be like below.
Program_Name Effective_Date Valid_Flag
ABCD 2/10/2012 N -- I have preserved the first record
ABCD 2/20/2012 Y -- Valid_Flag chages to a Y for teh first time and so on.
ABCD 3/01/2012 N
ABCD 3/14/2012 Y
ABCD 3/25/2012 N
ABCD 4/25/2012 Y
If there is no change in the flag, I do not have to pull that record.
View 3 Replies
View Related
Oct 18, 2012
I have a scenario, where I need to find the bucket values with the flag as "Y". The problem is i have 5 buckets
Bkt1 Bkt2 Bkt3 Bkt4 Bkt5 Flag
------------------------------------------
1000 500 230 100 677 Y
789 100 122 666 888 N
783 110 142 166 788 N
781 110 112 616 988 Y
709 130 121 661 878 N
Here I need to write a SQL query in Oracle 10g fetching the respective bucket value(for all the 5 buckets) along with the flag as "Y" and more importantly should have the bucket name as well.This is needed as in the UI we need to display the respective bkt value which is "Y" as bold.
So in the final List I need to have the VO which should contain the respective bucket name, respective value and flag as "Y"
Some thing like this I need to get in my final ArrayList in java
Bkt1 1000 Y
Bkt1 781 Y
Bkt2 500 Y
Bkt2 110 Y
Bkt3 230 Y
Bkt3 112 Y
Bkt4 100 Y
Bkt4 616 Y
Bkt5 677 Y
Bkt5 988 Y
how we can do it using the SQL query.
View 16 Replies
View Related
Jul 5, 2012
I am on 11.2.0.2 (RHEL 5.4)
For one of my OLTP table, we have skewed distribution on STATUS column and hence we created frequency histograms. NDV=7 for this column.
My question is : Do we need to have "_optim_peek_user_binds" set to TRUE in order to utilize Adaptive Cursor Sharing ?I have gone through different OTN forum and blogs and it appears that in order to generate different plans, Oracle has to Peek the value of bind variables each time. Without Peeking, how would CBO knows whether to generate new plans or not ?
For xyz reasons, optimpeek_user_binds is set to FALSE in my database and i could not find any sql_id having V$SQL.IS_BIND_AWARE='Y'.
View 9 Replies
View Related
Jan 29, 2011
I am working on an archiving strategy. I want to roll off transactions that are older than seven days, but only if they are flagged as Completed. The numbers of transactions are very large so this is a worthwhile venture.
The only strategy I have been able to come up with so far is to partiton on date. Then when 7 days comes up, sweep the about-to-be archived day for the few remaining not Completed transactions, put those into a new table (a new version of this partiton) and switch partitions. Each day I do this until the older parititions are empty.
View 7 Replies
View Related
Mar 16, 2012
for making the query for following data,when we give start and end date then query need to calculate number of years.
if less than one year then return 0
if exact one year then return 1
if exact 1.5 years (18 months) then return 2
if exact 2 years (24 months) then also return 2
if exact 2.5 years (30 months) then return 3
if exact 3 years (36 months) then also return 3
if exact 3.5 years (42 months) then return 4
if exact 4 years (48 months) then also return 4
and so.
also we need to add leap year 1 day if exist in start and end date.
YearSalary
11
1.52
22
2.53
33
3.54
44
4.55
55
[code]....
View 15 Replies
View Related
May 11, 2012
Our "client" is delivering data that contains an "age" field. However, they've put the AGE in DAYS instead of years, while our system can only work with years. So I needed to convert the age to years.
We are getting 2 parameters: LOWAGE and HIGHAGE (both in days). However, for the same "test" (laboratory test), we are also getting some other records
eg:
TEST 1 lowage = 0 upperage = 5 OTHER values = xxx
TEST 1 lowage = 6 upperage = 100 OTHER values = yyy
So if the person would be 5 years or less, the values xxx would apply. If they are 6 years and older, the yyy values apply. Now, the problem is that we are not getting this data in years, but in days. And whichever function I try, the upperage from the first test also seems to be equal to the lowerage from the second test. And this gives an error, because both would apply to this person....
I've tried stuff like:
age/365
age/365.25 (leap years)
trunc(months_between(sysdate+ranges.lowerage,sysdate)/12)
View 6 Replies
View Related
Feb 15, 2013
I am trying to generate a list of years, starting with 2010 and counting up through 5 years from the current date. For example, if it is currently 2013, the list would include 2010 through 2018. 2 years from now, I want the list to go from 2010 through 2020.
I am currently using
SELECT to_char(add_months(to_date('2010','YYYY'),12 * (rownum-1)),'YYYY')
FROM dual
CONNECT BY level <= 10to get a list with 10 entries.
How can I make this dynamic enough to return a variable number of records depending on the current year?
View 1 Replies
View Related
Mar 5, 2008
I have a SQL link table called student_monitor containing the follwing attributes and e.g. data
student_id, Class_id, Predicted_Grade, Actual_Grade
1 1 A C
2 1 B B
3 1 C B
I need to be able to flag which students are under achieving on their target grades and dont know how to do this or the best way to do this as i cannot calculate the diff between a char?
View 1 Replies
View Related
Jul 29, 2013
I would like to update the complete flag of all the rows of a table except the most recent two rows of each category.
The table has fields like:
category - string,
item - string,
creation_date - string ('YYYYMMDDHHMI'),
complete_flag - boolean,
etc.
Each category does not have the same amount of records with the same creation_date so I do not want to filter by creation_date. Is there a way to accomplish this?
View 8 Replies
View Related
Apr 5, 2011
I require to find the years between any given date range. For example what are the years between the dates '01/12/2010' and '01/02/2012'? Answer must be '2010,2011,2012'. how to code the query for this result?
View 2 Replies
View Related
Aug 8, 2010
I have a question to write a pl/sql for Chinese zodiac but i cant do it, even i Google it i cant find any solution..the question is as below:
The Chinese zodiac associates birth years with the following; animals:
Birth Year Animal
1924,1936.1948,1960,1972,1984,1996 Rat
1925,1937,1949,1961,1973,1985,1997 Cow
1926,1938,1950,1962,1974,1986,1998 Tiger
1927,1939,1951,1963,1975,1987,1999 Rabbit
1928,1940,1952.1964,1976,1988,2000 Dragon
1929,1941,1953,1965,1977,1989,2001 Snake
1930,1942,1954,1966.1978,1990,2002 Horse
1931,1943,1955.1967,1979,1991,2003 Sheep
1932,1944,1956,1968,1980,1992,2004 Monkey
1933,1945,1957,1969,1981,1993,2005 Chicken
1934.1946,1958,1970,1982,1994,2006 Dog
1935,1947,1959,1971,1983,1995,2007 Pig
Write a command to declare a date variable named birth_date, and assign to it your birth date. Use an IF/ELS1F structure to test every year and determine the animal associated with your birth year. Then display your birth year and the associated animal name. For example, the program would display the following output for someone born in 1984:
I was born in 1984, which is the year of the Rat. Declare and use additional variables as needed.
View 18 Replies
View Related
Jul 30, 2012
I would like to convert a number to years & months.
e.g. 119 = 9 years and 11 months
This would be displayed as 9.11
Is there an oracle function or sql that can calculate this value,
View 8 Replies
View Related
Jan 9, 2012
The stand alone stored procedure has 2 parameter, an IN and OUT...
CREATE OR REPLACE PROCEDURE someprocedure( businessdate IN NUMBER,
tablename OUT VARCHAR2)
This procedure has multiple inner blocks. Intention is to control execution of each of the inner blocks basing on the value of flag field obtained from a "processlogtable". This processlog table has structure as below.
jobname varchar2(100)
controldate (date)
controlflag varchar2(1)
I have the below code snippet at the beginning of each inner block that checks value of the flag and then proceeds with execution of that block. The intent is to avoid redundant call of a block that has successfully executed first time. That is, once a specific inner block fails for some reason, the re-execution of the stored procedure should AVOID re-executing the PRIOR successed steps.
I've the code set up as below, but the prior successed block(s) code gets re-executed again once the procedure is re-executed after a failure.
CREATE OR REPLACE PROCEDURE someprocedure( businessdate IN NUMBER,tablename OUT VARCHAR2)
CURSOR c_missingtablename
IS
SELECT datatablename
FROM (
SELECT UPPER(datatablename ) TABLE
FROM
WHERE datatableName IN ('Aaa','BbB','CcC');
[code]....
View 5 Replies
View Related
Jul 15, 2013
I would like to spool a clob column to a flag file, however some of the clob are greater than 32k, and I have to have the same record in a single line in the file. Is there any way to achieve this through spooling?
set heading off
set feedback off
set term off
set long 1000000
set longchunksize 500000
set line 32767
set trimspool on
set pagesize 50000
spool file.txt
@--this is my select statement.
spool off
exit
View 1 Replies
View Related
Mar 26, 2011
I am trying to set a item to system date + 18 years. What type of formula or where to put such a thing. i tried putting- select add_months(sysdate,216) from dual; into the calculation-formula in property palette with no success.
View 1 Replies
View Related
Nov 2, 2012
I have two table APPLICATION_1 and APPLICATION_2, where user's login date is captured.There will be multiple records for each user.Same user may or may not be present in both tables.
The requirement is to find those users who have not logged-in in the last 3 years.
-- Test Case
DROP TABLE application_1;
DROP TABLE application_2;
CREATE TABLE application_1
(
seq NUMBER ,
user_id VARCHAR2(30),
[code].....
Using the below query I'm able to get the desired output.
SELECT user_id, MAX(login_date) last_login_date FROM (
SELECT user_id, MAX(login_date) login_date FROM application_1 GROUP BY user_id
UNION ALL
SELECT user_id, MAX(login_date) login_date FROM application_2 GROUP BY user_id
) GROUP BY user_id
[code].....
View 10 Replies
View Related
Aug 24, 2012
I need to calcuate balance for last two cooprative years on input date.
example
if input date is-->"01-AUG-2012" if (month >=7) -->then i need to calculate from 01-july-2010 to 30-june-2011 and 01-july-2011 to 30-june-2012 and 01-july-2012 to input date.
if input date is-->"01-june-2012" if (month<7) -->then i need to calculate from 01-july-2009 to 30-june-2010 and 01-july-2010 to 30-june-2011 and 01-july-2011 to input date.
how to achieve this logic
View 4 Replies
View Related
Oct 17, 2012
In Apex 4.2, the item validation of "Function Returning Boolean" and "Function Returning Error Text"; They seam to be backwards.
Is there a simple statement that can be used to fix this in the apex dictionary?
View 1 Replies
View Related