With the help of INTERVAL with the value of the column in to_char?
I have a table with data having a datetime value in a column and a zone in the next column offset, designated as an integer (-6, - 7, etc.) I need to get the value of real time for use in queries, but I can't seem to find a way to do this without creating my own function to do so.Basically, I have to be able to do something like this:
SELECT LOCATION_DATE + INTERVAL LOCATION_TIMEZONE HOUR from tablex
LOCATION_DATE and LOCATION_TIMEZONE are columns in tablexThis function seems to work:
CREATE OR REPLACE FUNCTION FN_SHIFTDATE(dt DATE, tz VARCHAR2)
RETURN DATE
IS
f_dt DATE;
f_tz VARCHAR2(3);
v_sql VARCHAR2(500);
r_dt DATE;
BEGIN
f_dt := dt;
f_tz := tz;
v_sql := 'select to_date('''|| to_char(f_dt,'MM/DD/YYYY HH24:MI:SS')||''',''MM/DD/YYYY HH24:MI:SS'')'||'+INTERVAL '''|| f_tz ||''' HOUR from dual';
EXECUTE IMMEDIATE v_sql into r_dt;
RETURN r_dt;
END;
/
I was just curious if there was a way to do it directly in SQL without having to call a function every time to slow down the query.
So, you want to just add a number of hours on a date?
select LOCATION_DATE + LOCATION_TIMEZONE/24 NEW_TIME from tablex
Max
http://oracleitalia.WordPress.com
Published by: Massimo Ruocchio, February 19, 2010 12:21 AM
Tags: Database
Similar Questions
-
LINES in COLUMNS with different values for each column (after division)
Hello
I have a table called summary where I produced, month, value,.
When I used select * tab, I get months jan, Feb, mar, Apr. I wrote a query to get the months(jan,feb,...) columns
SELECTmax (DECODE(ROWNUM,1,month)) Column1
+ Max (decode(rowNum,2,month)) table Column2 +.
as this up to 12 months
After that, I want to get the NEWVALUE for each month.
I wrote a query to get the value, but I get the value only for the first month, and for the rest, I get NULL values.
Select max (DECODE(ROWNUM,2,vallue)) Column1, Column2 of max table (DECODE(ROWNUM,3,vallue))
Is it possible to get the newvalues for each month (in sql only) if so, please help me
Thank you
Chand
-
I have a text file with numeric data in three columns, (I need to spend the few lines of text in the file above the three columns of values of data first) then I need to convert numeric values above-"999" to zero, then take the average of each value of 500 in the first column (second and third colum requires the same operation separately) , so found average values should be stored in a text file and finally plotted in a graph separately. Help, please. Its part of my project work.
Another version, simply drag and drop:
-
LOV property for the 'return' with pragmatic value
Hi gurus,
I use
Forms [64 Bit] Version 11.1.2.2.0 (Production)
Database Oracle 12 c Enterprise Edition Release 12.1.0.2.0 - 64 bit Production
With the options of partitioning, OLAP, advanced analytics and Real Application Testing
How can I set property LOV to return the value of a column with pragmatism.
We're going on the basis of a State, I want Field2 value in any other column we will say that it is Control.attribute3
Dear Sir
You cannot change the name of checking back to a LOV. Instead, you can return the value of a dummy control, and then you can assign the value to different controls depending on the condition.
I hope this helps.
Manu.
-
Hi all
I haven't worked much on tabular forms and JS. I'm looking for help in this regard.
I'm working on a tabular presentation. with several editable fields... I need to disable a column (just for this single line), which contains an image, based on a field of LOV (static) list) (Y/N). The image column must be disabled if the value is N.
My SQL for the report is something like this: (will keep things simple)
Select
emp_id,
emp_name,
static_list,
(case when STATIC_LIST = "Y" THEN ' < a title = "Edit SAMPLE TBL" href = "f?) p = & APP_ID.:10: & APP_SESSION.:NO:P10_EMP_ID, P10_EMP_NAME :'|| EMP_ID | «, » || EMP_NAME | "" "> < img src =" "#IMAGE_PREFIX #SAMPLE.gif" border = '0' (> < /a > ' other ' ' end) as disable_col, "
dept_name
of sample_table
I scoured the topics in this forum. Most of them were made using the table ID f_001, f_002.
I tried to follow the same path by inspecting the item but the disable_col does not have any ID. Let's say, f_003 is for the static list and f_004 is assigned to dept_name.
I tried dynamic actions, but it did not work. Read in a topic that dynamic action does not work on tables. So I chose this approach. Is there a simpler way to solve this?
need your help on how to proceed with this scenario. Thank you in advance.
Versions: Apex: 4.2, DB: 11 g
Thank you
Daniel
Hi Daniel_A,
Daniel_A wrote:
I did my job in Page 4.
If the IS_VALID column is select as 'Yes' then the column hyper must be enabled, allowing the user to click on it. If she chose the 'no', then the column Hyper must be disabled for this line.
The initial question about toggle the hyperlink is resolved. Check your App-> Page 4 35160.
This is done with the help of two dynamic actions:
- DA first loading of the Page / after updating of region "tabular":
Event: After refresh
Selection type: region
Region: The other 'tabular '.
Condition: No strings attached
Action: Run the JavaScript Code
Fire on loading the Page: Yes
Code:
$( 'select[name="f08"]' ).each(function() { if ( $(this).val() === "N" ) { $(this).closest("tr").find('td[headers="HYPER"]').find("a").addClass("apex_disabled").unbind("click"); } });
Items concerned: no item affected
- Second DA on the evolution of the selection list:
Event: change
Selection type: jQuery Selector
jQuery Selector: select [name = "f08"]
Condition: No strings attached
Action: Run the JavaScript Code
Fire on loading the Page: No.
Code:
var el = this.triggeringElement; if ( el.value === "N" ) { $(el).closest("tr").find('td[headers="HYPER"]').find("a").addClass("apex_disabled").unbind("click"); } else { $(el).closest("tr").find('td[headers="HYPER"]').find("a").removeClass("apex_disabled").bind("click"); }
Items concerned: no item affected
NOTE: as the original question/topic related to toggle the image link in the column, for the problem with the Page 5, please create a new thread with the details.
Kind regards
Kiran
-
Need help with the analytical function select maximum and minimum of the results of the column
Hey there OTN.
I have an interesting application that I was hoping you would be able to help me with. I have a requirement to conditionally select the max and min of a column in bi-editor and since my editor works from an OBIEE analysis, I need store MAX and MIN of the column values in separate columns to match with. See the example below. You will notice that there are 4 stores including today's sales. I must have OBIEE through all the results of the column for sales, then choose the max of the dataset object. I can't use MAX here because he will choose the MAX of the line which will return only sales of this line. Instead, one must analyze all sales results and choose the appropriate column. Any idea on how to do this in OBIEE/publisher? Or is this not possible.
Day Store Sales Sales of MAX Sales MIN 05/11/15 Store 1 5000 8000 1000 05/11/15 Store 2 7500 8000 1000 05/11/15 Store 3 1000 8000 1000 05/11/15 Store 4 8000 8000 1000 I'm waiting for your answers. Thanks in advance!
PS: I will always mark messages that are useful and eventually mark it as correct answer if we come to a resolution!
See you soon.
You can't do the same thing with RANK ("dirty")?
Rank ("dirty") = 1: the max value in the result of sales
RANK (-1 * "Sales") = 1: the min in the result of sales value
I guess you can and then format the cells based on these values, where a value of 1 is the max or min according to the RANKING formula you used...
-
I have a table with a city of the column. Values are 'delhi' and 'hyderabad '.
I have a table with a city of the column. Values are 'delhi' and 'hyderabad '.
as
ID | City
---------------------------
1 | Delhi
----------------------------
2 | Hyderabad
Now, I have to update Delhi and Hyderabad Hyderabad with Delhi.
How to do this?
Hi Indi,
(1) why do you want what it? Requirements of companies?
(2) how much these values you want to reverse? Is it only "Delhi" and "Hyderabad", or there is a list, or other logic?
Update your_table
Set city = decode (lower (city), 'delhi', 'Hyderabad', 'hyderabad', 'Delhi')
where lower (city) ('Delhi', 'hyderabad');
Does that help?
-
OPV with distinct values for the guests
Hi all
Could you get it someone please let me know where/what I'm wrong. I created the couple of OPV to get distinct values, as I can't use the view that has millions of data to load guests.
These OPV is not directly attached to my main table but joined someother tables; After you add the guests in the responses, is to show the below error
[nQSError: 14070] can't find coverage source logical table to the columns of the logic: [bp Manager]. Please check more detailed level keys are correctly mapped. (HY000)
I wan to the OPV use only for guests and pass the values to help requested on the main table filters
I have no warnings/errors in my model. What could be the problem? Thank you for your time
REDA
Just go with PSV.
Check it cool - bi.com for "what happens when we select all the column values.
Table x got to join the only 1OPV then how can you expect comes from BI to the other 2 open-pollinated varieties? Likewise, we cannot write query!
If you can create a domain for each OPV then proceed with a command prompt with the UNION of 3 open-pollinated varieties clause
-
Return only the columns with different values.
Hi all
I am trying to solve a seemingly trivial problem but can't seem to get any clear answer anywhere in any forum. Consider a single table with 5 columns and only two lines:
Assume that there is no primary key or any other constraint. Also assume that there are only and only two lines of this table. So I need basically a query that, overall above lines, would return first name and sex, because they are only different columns in two lines, as well as their values. Even if I can get sort of column names that are different and that would be enough that I can easily access the values later. It is also important to remember that I may not know the names of the columns in the columns, so basically, somehow, I use user_tab_columns in the process.row_id first_name last_name age gender 1 John doe 27 M 1 Jane doe 27 F
Any help appreciated.
Published by: 894302 on May 1, 2013 10:35Hello
894302 wrote:
The exact release could be just a varchar variable that lists all the columns that have different values with each column name separated by commas. We'll call the query you want as a QUERY. So, if I do something likeSelect the REQUEST of double; Output should be: 'first_name, equality of the sexes. Is this possible?
In this case:
SELECT RTRIM ( DECODE (a.row_id, b.row_id, NULL, 'row_id,') || DECODE (a.first_name, b.first_name, NULL, 'first_name,') || DECODE (a.last_name, b.last_name, NULL, 'last_name,') || DECODE (a.age, b.age, NULL, 'age,') || DECODE (a.gender, b.gender, NULL, 'gender,') , ',' ) AS different_columns FROM rhit_table_x a JOIN rhit_table_x b ON a.ROWID < b.ROWID ;
Output:
DIFFERENT_COLUMNS --------------------------------------- first_name,gender
This assumes that you have really a table, then you can use ROWID to distinguish the lines, since there is no primary key.
If this isn't the case, you first assign ROW_NUMBER in a subquery. -
How can I replace the value of the column with a particular value in SQL
Hi all
Is someone can you please tell me how can I format my output with the replacement of a column value with a specific value that really depends on the current value of the column
I am executing the following SQL statement
Select state, count (id) from < table_name > where composite_dn = < composite_dn_name > Group by State;
My current performance is:
State Instance number
1 3
3 28
I want to replace the value in the State column as follows
No.OfInstances State
3 filled
28 faulted
I want '1' to be reppaced of 'Done' and '3' is replaced by 'Faulted. '
Is is possible with SQL or PL/SQL, if it is then how I can achieve this required. Help, please!
Thanks in advance!
Published by: Roshni Shankar on October 27, 2012 12:38 AMHi Claude,.
I guess this CASE clause can be simulated by a DECODE and also it is very easy to use.
See - http://www.techonthenet.com/oracle/functions/decode.phpselect decode(t1.state,t2.state_id,t2.state_name), t1.count_id from
t2, (select state,count(id) count_id from where composite_dn= group by state) t1 where t1.state = t2.state_id; HTH
Vanessa B.Published by: Vanessa B on October 27, 2012 14:02
-link addedPublished by: Vanessa B on October 27, 2012 14:19
-added code sample -
Fill two empty columns with the values in a column (all in the same table)
Can someone point me in the right direction? I want to fill the column prefix and suffix with the AcctNum data.
"Prefix is the part of the number before the '-' and the suffix is everything after the '-'. '. Write a SQL command to fill the column prefix and suffix.
It is supposed to look like this:*Accounts* AcctNum Prefix Suffix ------- ------ ------- 123-0097 X089-056 123-0097 123-0098 F3377-D X089-057 X089-058 3-009712
That's what I came with, but it does not work because it is basically putting multiple values into a single cell:*Accounts* AcctNum Prefix Suffix ------- ------ ------- 123-0097 123 0097 X089-056 123-0097 123-0098 F3377-D X089-057 X089-058 3-009712
I want this query is incredibly easy and I have forget something. Any help is greatly appreciated.update accounts set prefix=(select substr(acctnum, 1, instr(acctnum,'-')-1) from accounts), suffix=(select substr(acctnum, instr(acctnum, '-')+1) from accounts) where acctnum=(select prefix||'-'||suffix from accounts);
Published by: 885913 on September 18, 2011 12:53UPDATE accounts a SET ( prefix, suffix ) = (SELECT Substr(acctnum, 1, Instr(acctnum, '-') - 1), Substr(acctnum, Instr(acctnum, '-') + 1) FROM accounts b WHERE a.acctnum = b.acctnum);
-
Fill the table with random values
Another thing I've come across is this:
the table name is LOR, who has 3 fields NUMBER, DATA, TEXT with number, date and varchar2 data type.
On a page, I have a text field where if I write 3, then it would add 3 lines to the table with predefined values ("number, something like 2222, for 12 January 09, and for text, something like" Lorem ipsum dolor sit amet, 195kgs adipisicing elit"). So basically, with the number that I give, it populates the table with lines... How can I do this? Thanks for helping meINSERT INTO LOR SELECT 222 , sysdate , 'you string' FROM dual CONNECT BY level <= :Pxx_
-
I have a column with two values, separated by a space, in each line. How do I create 2 new columns with the first value in one column and the second value in another column?
Add two new columns after than the original with space separated values column.
Select cell B1 and type (or copy and paste it here) the formula:
= IF (Len (a1) > 0, LEFT (A1, FIND ("", A1) −1), ' ')
shortcut for this is:
B1 = if (Len (a1) > 0, LEFT (A1, FIND ("", A1) −1), ' ')
C1 = if (Len (a1) > 0, Member SUBSTITUTE (A1, B1 & "", ""), "")
or
the formula of the C1 could also be:
= IF (Len (a1) > 0, RIGHT (A1, LEN (A1) −FIND ("", A1)), "")
Select cells B1 and C1, copy
Select cells B1 at the end of the C column, paste
-
align the cells with shared values
3.6.1 the numbers
I would like to compare two columns and align the cells, if they are equal. Ideally, I would like to include the adjacent cells in the second column in the alignment.
Example:
Run the formula (if possible) to format the following text:
As follows:
Hi cnickflight,
Easy to do by transferring the data to another table.
Table 1 contains the original data. I reduced the names of fruits to three letter codes to reduce type them, but this does not change the process.
Column A of table 2 contains a formula that copies the existing data in column A of table 1 and insert null strings when there is no data in the table 1.
The formula is entered in cell A2 and filled down.
Table 2::A2: = IF (ROW () −1 > COUNTA (table 1::A),"', SHIFT (table 1::$A$1,ROW()−1,0))))
Fill until the end of the column.
Columns B and C contain a VLOOKUP formula. The formula is the same in the two columns, with the exception of the number indicating which column of the table, the returned value must come. The version of 'testing' of the formula in B2 is shown. When filled to the bottom, this formula should copy the names of fruits where they are both on the table 1, in the line that they appear in column A, and display a triangle of error in the lines where there is no name in column B to the one in the column (and in the rows where column A is empty). The error message for each of them should be "VLOOKUP couldn't find the requested value."
Table 2::B2 (trial version): = VLOOKUP ($A, table 1: $b$ C, 1, FALSE)
(FALSE appears in the formula as 'exact match' editor)
If the behavior is as described, add IFERROR before VLOOKUP, and , "") after the closing parenthesis to match the 'final version'. " (See "why two versions? below.)
2::B2 (final version) of the table: SIERREUR = (VLOOKUP ($A, table 1: $b$ C,1, FALSE),' ')
2::C2 (final version) of the table: SIERREUR = (VLOOKUP ($A, table 1: $b$ C,2, FALSE),' ')
Fill both until the end of their respective columns. Results should now be as shown above.
Note: Why two versions?
Function SIERREUR is ideal for use as a trap for the error, but it acts on all errors, not only the one you plan to trap. Best practice is to add to this trap only if you are sure that the formula generates other error messages that awaits you and using in this case we know VLOOKUP, who has been charged with finding an "exact match" will throw an error when it does. Function SIERREUR catches this error and puts a string anywhere in the cell, making it appear empty.
Kind regards
Barry
-
I just got an email saying that I bought 3 movie rentals with a value of £116,15 via the iTunes store. I've done this! Someone else?
This is a phishing attempt. Do not respond. Shall not disclose any personal or financial information. You can use the address below to the suspicious message as an attachment to the Apple. [email protected]
The link below has information to identify fraudulent emails.
Maybe you are looking for
-
How to disable the backlight on the keypad for the Qosmio X 70-A-120
Please, do you know how to disable the backlight on the keypad for the QOSMIO X 70-A-120? Concerning
-
How to access MyLV8.5.llb of Main.vi?
I have a LabVIEW6.1 library, MyLV8.5.llb, which I would like to integrate with my program calling Main.vi LV8.5. How can I know the LV8.5 compiler to search for MyLV8.5.llb my subsidiary screws of implementation, rather than go through a whole long (
-
I recently installed windows Vista Home Basic on a hard nine. I want to install sp1, but after long hours of reboot and installation, step 3 of 3, it says "cannot install, restoration of the changes." subsequently, an error message appears indicating
-
I receive a report of an error on one of my disk on drive c to start the computer. So I tried to use computers disk scan and auto repair function, it tells me it cannot do, while the disk is in use so I schedule a scan and when computer restars BAROM
-
I want to install the software of webcam ssd350
My ssd350 webcam software does not work I want to download webcam installation Left OneDrive for Windows 7