Oracle Dataset - How To Split Datetime

Jun 2, 2008

my problem is:

i running a sql-query in visual studio 2005 with the oracle dataset. currently my datetime is in format mm/dd/yyyy hh:mm:ss. I wish to split the datetime in dd/mm/yyyy only(without the hh:mm:ss)

EXEC ('
SELECT
XNP_TIMER_VIOLATION.VIOLATION_TIME,..
FROM XNP_TIMER_VIOLATION,..
) AT npcrpt ;

View 4 Replies


ADVERTISEMENT

Oracle Dataset In Visual Studio 2005

Jun 1, 2008

i'm newbie in oracle and visual studio 2005..i running a sql-query in visual studio 2005 with the oracle dataset..i want the data that displayed is in the date range and the parameter is set by user..

EXEC ('
SELECT DISTINCT
XNP_TIMER_VIOLATION.VIOLATION_TIME,

FROM
XNP_TIMER_VIOLATION, ...

WHERE
(DATEADD(hh, 8,XNP_TIMER_VIOLATION.VIOLATION_TIME) BETWEEN ? AND ?)',@FROM_DATE, @TO_DATE ) AT npcrpt ;

View 4 Replies View Related

PL/SQL :: Insert Dataset Into Some Table?

Jul 9, 2013

Can we use result of with query_name ... to insert dataset into some table? I'm usung 11.2.0.3 

View 5 Replies View Related

Split A String In Oracle

Sep 27, 2010

I have a string like '9999999;A' one field as numeric & other as char.Now i want to split this string into two values removing the ; delimiter in oracle using for loop.

View 2 Replies View Related

SQL & PL/SQL :: How To Get Max (value) With Its Corresponding Datetime

Sep 22, 2013

This is my table

ID timestamp value
1 2013-09-09 01:09:00.000 1234
2 2013-09-09 02:00:00.000 123
1 2013-09-09 03:09:00.000 1233
2 2013-09-09 21:09:00.000 125

I need to find max(value) with its corresponding time stamp .. this table has approximately 500000 records with 180 distinct IDs. Need to find max(value) group by IDs.

Expected result:

ID timestamp value
1 2013-09-09 01:09:00.000 1234
2 2013-09-09 21:09:00.000 125

We have a query but its returns 00 in hh:mm:ss instead of exact timestamp.

View 15 Replies View Related

SQL & PL/SQL :: How To Get The Time From Datetime

Oct 12, 2012

i am using one stored procedure there in one variable value is coming like this: Jan 1 1900 6:00AM

from this i want time how to get the time from that.

View 3 Replies View Related

SQL & PL/SQL :: Set Datetime Globally

Jun 23, 2011

I am facing problem to set date & time globally in oracle. I set date-time many time but it is on session base.

View 28 Replies View Related

SQL & PL/SQL :: Dataset From Two Sets Of Tables Based On Condition

Nov 26, 2010

have two queries that will return same columns from two different set of tables ( column mapping has been taken care of). The return type is out ref cursor. (P_SUPPLY_REORDER )

Query 1-SO
-----------------------------------
select
so.SMO_NO,
so.SPLY_ORD_DT,
so.fk_CUST_ID as CUST_ID,
so.CUST_PO_NO,
so.ATTENTION_NAME,
[code].....

Query-2 Xcom
--------------------------------------
select
null as sMO_NO,
xso.created_date as SPLY_ORD_DT,
xso.fk_cust_id as cust_id,
cust.cust_po_no as cust_PO_NO
,(sta.SHIP_TO_ATTN_FIRST_NAME||''||sta.SHIP_TO_ATTN_LAST_NAME) as attention_name,
xsol.CARTONS_ORDERED as SPLY_ORD_QTY,
[code].......

Now the requirement is
One of four conditions are possible for each Supply Reorder Number:

. Both table queries return no records- Populate all the P_SUPPLY_REORDER output fields with nulls
. SUPPLY_ORDER returns a record, but XCOM_ORDER_HEADER returns no records
- Populate output fields with values from the join of SUPPLY_ORDER and SUPPLY_ORDER_LINE.
. SUPPLY_ORDER returns no records, but XCOM_ORDER_HEADER returns one record
- Populate output fields with values from the join of XCOM_ORDER_HEADER and XCOM_ORDER_LINES.
. SUPPLY_ORDER returns a record, and XCOM_ORDER_HEADER returns a record; find out the latest order by comapring max(SPLY_ORD_DT)
from SUPPLY_ORDER with max(CREATED_DATE) from XCOM_ORDER_HEADER.
- If the latest order is in SUPPLY_ORDER, then populate output fields with values from the join of SUPPLY_ORDER and SUPPLY_ORDER_LINE.
- If order dates are equal from both join results, then populate output fields with values from the join of SUPPLY_ORDER and SUPPLY_ORDER_LINE.
- If the latest order is in XCOM_ORDER_HEADER, then populate output fields with values from the join of XCOM_ORDER_HEADER and XCOM_ORDER_LINES.

Question is how can we switch over the queries to pull respective dataset based on these conditions ( checking that which table join is going to return a row and then based upon latest order if both tables return a row) and all this logic as part of single SQL statement that is returned as OUT Ref Cursor.

View 7 Replies View Related

SQL & PL/SQL :: ANSI Join Returning Wrong Dataset?

May 25, 2011

...continued from "Problems with full outer join"I think that ANSI joins in Oracle doesn't work correctly. Or am I doing something wrong? The query looks like this:

select nvl(k.id_pers,t.id_pers) id_pers, k.dat_avst
, id_trans, dat_trans
from
( select ka.id_pers, ka.dat_avst, ka.dat_nasta_avst

[code]...

It's a full outer join between one table (with a subquery) and an inline view with two tables You can see the returned rows in the listing below. The query returns one row where there is a match between t_trans and t_kontoavst.It also returns two rows from table t_kontoavst with no correspondence in t_trans.Finally it returns 26 rows from the table t_trans with no correspondence in t_kontoavst. But among them there are many rows in contradiction to the conditions:

and trunc(dat_trans) >= to_date('20040101','yyyymmdd')
and trunc(dat_trans) <= to_date('20050604','yyyymmdd')

Actually it seems to return all the 27 rows in t_trans (one of them joined to t_kontoavst).These conditions are actually not part of the join so I changed it to:

where trunc(dat_trans) >= to_date('20040101','yyyymmdd')
and trunc(dat_trans) <= to_date('20050604','yyyymmdd')

It's not clear to me if this where condition belongs to the joined result or just to the right joined inline view.With this change the correct rows from t_trans where returned but unfortunately the two rows from t_kontoavst with no correspondence in t_transdisappeared. I thought maybe that is because dat_trans is null for these two rows after the join. Therfore I also includeddat_trans to be null. This can only happen when t_trans is missing

where dat_trans is null
or (trunc(dat_trans) >= to_date('20040101','yyyymmdd')
and trunc(dat_trans) <= to_date('20050604','yyyymmdd'))

But that didn't change the result I have also tried right and left joins and it produces similar errors.One other thing i tried was to replace the inline view with one of the underlying tables t_trans. But the result was the same.Data returned from the original query (see query above):

ID_PERSDAT_AVSTID_TRANSDAT_TRANS
1945050505022005-05-011721642005-05-16
194505050502null1723722005-06-16
194505050502null1723732005-07-16

[code]...

Data in the tables.SQL Statement which produced this data:

select id_trans, id_pers, dat_trans
from t_trans
order by id_pers, dat_trans, id_trans

ID_TRANSID_PERSDAT_TRANS
1721641945050505022005-05-16
1723721945050505022005-06-16
1723731945050505022005-07-16

[code]...

SQL Statement which produced this data:

select id_pers, dat_avst
from t_kontoavst
order by id_pers, dat_avst

ID_PERSDAT_AVST
1945050505021997-05-01
1945050505022005-05-01
1958080808071997-05-01

[code]...

View 16 Replies View Related

SQL & PL/SQL :: Convert Datetime To Date?

Nov 8, 2012

I know this question has been asked several times. but i am starting out and i am struggling to get my head aroung it.I would like to convert datetime column of Oracle source(RPT.SHIPMENT_VW) to date while loading to sql Here is my

SELECT SHIPMENT_NBR,RECEIVED_DATE_TIME, RCVD_AT_DATE_GMT_FK
FROM RPT.SHIPMENT_VW
where WHERE RECEIVED_DATE_TIME = TO_DATE(TO_CHAR(:fromdate, 'DD/MM/YYYY'))
here RECEIVED_DATE_TIME is in 'DD/MM/YY hh:mi:si' fromat which, i want to convert to 'DD/MM/YY'
the above code throwing an error ORA:01843 not a valid month

if I use where clause like:WHERE (RECEIVED_DATE_TIME = TO_DATE(TO_CHAR(:fromdate, 'DD/MM/YYYY'), 'DD/MM/YY'))then its not retrieving any data

View 6 Replies View Related

Forms :: Datetime Format

Mar 31, 2011

I have written the following assignment statement. :dshift_hdr.startdate := to_date(sysdate,'DD-MM-RR HH12:MI:SS');

the startdate is a display item. Its data type property has been set to datetime and the formatmask is DD-MM-RRRR HH12:MI:SS but the result of above assignment statement is 31-03-2011 12:00:00 i.e. it does not take the actual current time.

i have promised to install the application to the client tommorrow.

View 3 Replies View Related

SQL & PL/SQL :: DateTime Between Dates - How IDate Is Used

Apr 25, 2010

How 'idate' is used. For example in the following statement:

DELETE FROM SCHEMA.TABLE WHERE DATETIME BETWEEN TO_DATE(IDATE,'DD-MM-YY') AND TO_DATE(IDATE,'DD-MM-YY')+1-1/1440;

View 10 Replies View Related

SQL & PL/SQL :: Record Count Mismatch In Dataset And Query Executed

Oct 14, 2011

I am using an query to fetch the data from oracle DB and fill dataset using oledb dataadapter in ASP.net.When i run the same query in PL/SQL i am getting 14952 records,but when i am filling it to dataset i am getting only 13700 records.

View 2 Replies View Related

Convert DateTime Field To Date

Jun 11, 2010

I want to force a datetime field to display as date only. How can I do this? This is so when prompting for a value for this field a user doesn't have to also enter the time. At the moment the prompt returns nothing when entering only a date as it does not match any value as they all have times also.

View 12 Replies View Related

SQL & PL/SQL :: Filtering Dataset Based On Records Returned By Table Join

Nov 10, 2010

I need to work on this requirement.

There are FOUR tables ( T1 , T11 & T2, T22) ALL store order information.

One of four conditions are possible for each Supply Reorder Number:

•Both table queries return no records

oPopulate all the output fields with nulls

•T1 returns a record, but T2 returns no records

oPopulate output fields with values from the join of T1 and T11.

•T1 returns no records, but T2 returns one record

oPopulate output fields with values from the join of T2 and T22.

•T1 returns a record, and T2 returns a record

oIf the latest order is in T1, then populate output fields with values from the join of T1 and T11.

oIf order dates are equal from both join results, then populate output fields with values from the join of T1 and T11 .

oIf the latest order is in T2, then populate output fields with values from the join of T2 and T22.

How do we filter the dataset based on result of table join ?

View 1 Replies View Related

ODP.NET :: Updating Dataset / Datarow If Data Is Populated From Stored Procedure

Mar 11, 2013

I am using:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
Microsoft Visual Studio 2010 : VB Express
Microsoft .NET Framework : Version 4.0.30319 RTMRel

When I populate dataset using select query and use OracleCommandBuilder and update dataadapter, data is saved in database.

But if I put same select in store procedure and use this to populate dataset then data is not updated in db.

I get this error

Update requires a valid UpdateCommand when passed DataRow collection with modified rows.

at da1.Update(ds1, "req") where I am going wrong.

Dim conn As New OracleConnection
        Dim da1 As OracleDataAdapter = New OracleDataAdapter
        Dim ds1 = New DataSet
        With conn
            If .State = ConnectionState.Open Then .Close()

[Code]....

View 2 Replies View Related

Application Express :: DateTime Calculations On A Form

Jul 19, 2012

Version of the database you are using: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
Version of Application Express: 4.1.1.00.23

I have a requirement that is driving me stark raving bonkers.

I have a form that a user fills out, it sets the Status to 'Open' and I capture the Date Created On in a hidden field. When someone goes back in to the Form and sets the Status to 'Closed' I capture the Date Closed On in a hidden field. I need to calculate how many hours that it took to close the issue and display it on the form.

I found some javascript that does this

<Code>
<script type="text/javascript">
var msecPerMinute = 1000 * 60;
document.write("msecPerMinute -" + msecPerMinute + "<br />")
var msecPerHour = msecPerMinute * 60;
[code].......

While I can get it to work from dreamweaver I cannot get it to work from APEX. Both of my date fields in my database are defined as:

Type: TIMESTAMP
Fractional Precision: 6
Time Zone: LOCAL TIME ZONE

View 17 Replies View Related

Client Tools :: Handling DATETIME Format Using SQLPLUS COPY Command

Jul 29, 2012

I am using the SQL*PLUS COPY command to move the data from my database to another remote database. The data in my database also contains DATETIME format. But since COPY command cannot handle DATETIME format, I am wondering is there any workaround for this.

Note: Due to some limitations, I cannot use other methods like DATABASE LINK or EXPDP/IMPDP commands.

View 12 Replies View Related

SQL & PL/SQL :: Table Being Split Into Two

Jun 2, 2011

i'm working on this database assignment...and basically, no matter what I do my table seems to automatically split into a different table after 8 rows...i've tried googling it and using commands like....

set wrap off;
set numwidth 20;

and fiddling with the format of each column but nothing seems to work...i just want my table to show as one table

here's my script
create table patient
(patient_number number(4) primary key,
patient_name varchar(15) NOT NULL,
address varchar(30) NOT NULL,
telephone number(7) NOT NULL,
patient_status char(1) NOT NULL,
next_appt date,
balance number(5,2),
CHECK (balance >= 0),
CHECK (patient_status='N' OR patient_status='A' OR patient_status='I'));
[code]...

12 rows selected.the columns are actually aligned so don't worry about that...it's just the splitting of the rows.

View 5 Replies View Related

SQL & PL/SQL :: How To Split A String

Dec 21, 2011

I have strings like

1) ICE_10001 ICE_10002 ICE_10003

2) ICE_10005 ICE_10006

i want to split above strings like

1)ICE_10001
2)ICE_10002
3)ICE_10003
4)ICE_10005
5)ICE_10006

If it is possible in oracle sql

View 15 Replies View Related

PL/SQL :: How To Split Strings

Oct 18, 2013

PROCEDURE COLUMN_SPLIT (p_def   IN VARCHAR2, p_sch  OUT VARCHAR2, p_table OUT VARCHAR2, p_column OUT VARCHAR2) 
IS  
BEGIN 
NULL;  
END;
END; 

I want to split p_def by dots, check for 3 elements, and return them in p_sch, p_table and p_column for example p_sch will be like hello.howare.you.I want to split it to hellohowareyouI have very limited knowledge with pl/sql.

View 13 Replies View Related

Split A String Up If It Has Space?

Jun 19, 2008

i have a column called name in a table. now what iwould like to do is to check if it has two parts "paulh some" and then output the second part!

SELECT LTRIM(name,' '), length(name) length
FROM list
WHERE INSTR(name,' ') = 1;

but that doesnt work.. the fucntion is NOT checking for the space! if i use another character (a or b etc) it works..

View 2 Replies View Related

Split Value And Sort By Lastname?

Dec 11, 2008

I have a field called fullname that outputs records with fullname of people.

Here is what I have when I do this sql:

Select fullname from tableOne;

John Jones
Bill Aronsen
Sam Baker
George Williams
Dave Smith

I would like to sort in order of last name but cant figure out how to do the sql:

Bill Aronsen
Sam Baker
John Jones
Dave Smith
George Williams

View 1 Replies View Related

SQL & PL/SQL :: Split Long String

Feb 19, 2013

how I can change this function to pass argument that length is 32676 .

create or replace TYPE "HRS_SPLIT_TBL_T" as table of varchar2(32767);

create or replace function hrs_split
(
p_list varchar2,
p_del varchar2 := ','
) return hrs_split_tbl_t pipelined
is

[Code]...

I got error String literal too long when execute select below

select distinct COLUMN_VALUE Tbat_latn
from table(
HRS_SPLIT( 'PER0000002,PER0000094,PER0000094,PER0000096,PER0000096,
PER0000024,PER0000024,SAB0000001,SAB0000001,PER0000002,
PER0000096,PER0000094,PER0000094,PER0000002,PER0000024,
PER0000024,PER0000096,PER0000096,PER0000094,PER0000094,
PER0000002,PER0000024,PER0000024,PER0000096,PER0000096,
PER0000094,PER0000094,PER0000002,PER0000024,PER0000024,

[Code]....

View 12 Replies View Related

SQL & PL/SQL :: Split String In Two Halves?

Oct 23, 2013

I want to split any user given string into two parts, how can I do it.

suppose some sample inputs may be:

'123456' splits into '123','456' ,'123456789' splits into '12345','6789'

NOTE: the first half splitted string length is greater in case of odd no. string as in second example

How can I do it?

View 13 Replies View Related

SQL & PL/SQL :: How To Split Values From A Column

Jul 14, 2010

How to split the values from a column?

For example: i had table T1 with below structue

Table T1

userid
-------
sandy1234
raj6785
Andrew12367
Michael56098

i need output like below structure

Nameid
---- ----
Sandy1234
Raj6785
Andrew12367
Michael56098

View 5 Replies View Related

SQL & PL/SQL :: Split Gender To Two Column?

Feb 8, 2012

I have a table like follows

Name Gender
-------------
Arun M
Anitha F
Bala M
Banu F

I need the output as follows

Male Female
-----------------
Arun Anitha
Bala Banu

What are the ways can we generate the above query

View 14 Replies View Related

SQL & PL/SQL :: Split Csv To Multiple Records

Jun 18, 2013

I have a small requirement...

Create table temp_a (source_code varchar2(100), target_code varchar2(1000));

Insert into temp_a values ('1','002.0 AND 002.9');
Insert into temp_a values ('2','729.90 AND 079.99 AND 002.9');

Output :

1 002.0
1 002.9
2 729.90
2 079.99
2 002.9

So, once we get the output, it needs to be joined to another table. I did Google search, but most of them are retuning collections / arrays as output. Not sure how I join the collection with the table.

create or replace function splits
(
p_list varchar2,
p_del varchar2
) return split_tbl pipelined
is
l_idx pls_integer;
[code].......

View 3 Replies View Related

SQL & PL/SQL :: Split Result Set Into Column

Aug 17, 2012

i have a table emp with three column

columns are (empid varchar,empnomini varchar,nominitype varchar), data in table like

empid empnomini nominitype
1 x B
1 y c
2 xx B
2 yyyy c

and i want data comes like

empid nominitype b nominitype c
1 x y
2 xx yyyy.

View 6 Replies View Related

SQL & PL/SQL :: Split Ranges In Database?

May 5, 2010

I have been wracking my brain on this. Is there a way to write an SQL code that will combine split ranges within a table?

SAMPLE_TABLE
Common_FieldLow_ValueHigh_Value
1123123
11243000
130023005
130064000
135003501
130064500

I would like to combine any ranges that may exist. It is also possible that some row ranges may be nested in other rows.

END_RESULT
Common FieldLow ValueHigh Value
11233000
130024500

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved