Query for Tracking the database
Hai
i am entering Some process in Client Application. Each process some records get updated in database tables.
How can i fiind it? for example if i am updating engine menu of the application. engine table and some other tables are get updated. i dont have source code of application with me. how can i monitor that what are the tables get affected in the database.
we have to work from database side.
one thing i can do... write the query for table and count(*) after every process so that i can get which table get affected by identifying the row count.
but i want only particular table get affected on particular process.
Kindly give ur suggesiton
S
Well, you can connect as privileges user and issue:
ALTER SYSTEM SET SQL_TRACE=TRUE;This will enable trace of every user session. So it is better if you are the only one using application and database. To find trace files location issue:
SQL> select value from v$parameter where name = 'user_dump_dest';Trace files will have all SQL statements issued by a session. You can either read them raw (trace files are text files) or use Oracle supplied tkprof utility to format them.
SY.
P.S. Do not forget to turn off trace after you are done:
ALTER SYSTEM SET SQL_TRACE=FALSE;
Similar Messages
-
Tell me select Query that HITs the database Directly ???
Hi,
I have a table, for this table in the Techinical Setttings I selected Buffering allowed, and buffering type is Full Bufferd.Now, I want a Select Query which hits the database directly, without fetching records from the BUFFER.
Except using SELECT BYPASSING BUFFER query ????
Regards,
V.Raghavender.hi,
· Any SELECT with a sub query or with joins
· Any set function (COUNT, MIN, MAX, SUM, AVG)
· GROUP BY
· HAVING
· SELECT DISTINCT
· ORDER BY
Examples:
SELECT /*@ SAP BYPASSING BUFFER */ * FROM MYTAB
WHERE KEY1 = ? AND KEY2 = ?
SELECT * FROM MYTAB WHERE KEY1 = ?
SELECT * FROM MYTAB
WHERE KEY1 = ? AND KEY2 = ? OR KEY1 = ?
SELECT MAX(DATA) FROM MYTAB WHERE KEY1 = ? KEY2 = ?
SELECT * FROM MYTAB
WHERE KEY1 = ? AND KEY2 = ? AND DATA =
(SELECT DATA FROM MYTAB WHERE KEY1 = ? AND KEY2 = ?)
if helpful pls award points.
sri -
Query for seeing the amount of archive switchs per day
Hi
I want a query for seeing the amount of archive switchs per day.
Example:
date & amount
17/01/2009 40
18/01/2009 33
19/01/2009 45
ThanksHi friend Jamsher
I tested in a RAC database and the result is null....
SQL> SELECT ROUND(AVG(1440 * (b.first_time - a.first_time)), 0) "Log switch
2 time - minutes"
3 FROM v$loghist a, v$log b
4 WHERE b.sequence# = a.sequence# + 1
5 AND a.sequence# = (SELECT MAX(sequence#) FROM v$loghist)
6 ORDER BY a.sequence#;
Log switch
time - minutes
SQL>
Thanks -
Query for to get database size, used size, freesize, db size after drop
Pls give me a query for to get database size, used size, freesize, tablespacesize of sometables which is starting with 'RQ%'
I have to get result like this
Total size, used size, free size ,tablespace size of RQ tables alone
Reason why i go for "tablespace size of RQ tables" i want to know the size of database after deleting the rq tables
Pls reply
Si tried with
SELECT
--fs.tablespace_name name,
df.totalspace/1024/1024 mbytes,
(df.totalspace - fs.freespace)/1024/1024 used,
fs.freespace/1024/1024 free
FROM
(SELECT
--tablespace_name,
ROUND(SUM(bytes)) TotalSpace
FROM
dba_data_files
) df,
(SELECT
--tablespace_name,
ROUND(SUM(bytes)) FreeSpace
FROM
dba_free_space
) fs
i AM GETTING total bytes, used bytes, free bytes
I WANT TO include one more column.. database size after deleting rq tables
Pls reply
S
Edited by: AswinGousalya on Jul 10, 2009 2:17 PM -
Query for selecting the 4 highest marks of the student
query for selecting the 4 highest marks of the student
Guys dont start an argument,
tey this one; please
Hi,
Try this
Top 4
Select ename,
sale
From dept d,
emp e1
Where d.deptno = e1.deptno
And &p > (Select Count(e2.sal)
From emp e2
Where e2.sal > e1.sal
And e2.deptno = e1.deptno
Order By 1,2
Bottom 4
Select ename,
sale
From dept d,
emp e1
Where d.deptno = e1.deptno
And &p > (Select Count(e2.sal)
From emp e2
Where e2.sal < e1.sal
And e2.deptno = e1.deptno
Order By 1, 2
&P you use any value say 3,4,5,6
This is top N analysis
Regards
Umesh -
Query for deleting the minimum updated record.
Hello Everybody,
I have table USER_RECENT_PROJECTS which has SIX columns USER_NAME,PROJECT_ID,CREATED_BY,CREATED_ON,UPDATED_BY
and UPDATED_ON.The purpose of having this table to get 5 recent PROJECTS
on which user has worked on.
I have trigger called RECENT_PRJ_TRIGG which IS FIRED when the data is inserted or updated on PROJECT table.After this trigger calls procedure PROC_USER_RECENT_PRJ and that procedure puts the data in this table.
It is inserting the data upto 5 records when the six records comes it deleting the record which is least UPDATED_ON from the table USER_RECENT_PROJECTS but the problem is it is deleting
the record from other user that i don't want.I want to delete the the record which is
least UPDATED_ON from particular user.
Please help me on this issue.
Here is the trigger
CREATE TRIGGER RECENT_PRJ_TRIGG
AFTER INSERT OR UPDATE ON PROJECT
FOR EACH ROW
DECLARE
NUMBER_OF_PROJECTS NUMBER:=0;
EXISTING_PROJECT_ID NUMBER:=0;
BEGIN
SELECT COUNT(*) INTO NUMBER_OF_PROJECTS FROM USER_RECENT_PROJECTS WHERE USER_NAME=:NEW.UPDATED_BY;
SELECT PROJECT_ID INTO EXISTING_PROJECT_ID FROM USER_RECENT_PROJECTS WHERE PROJECT_ID=:NEW.PROJECT_ID AND USER_NAME=:NEW.UPDATED_BY;
NVLX.PROC_USER_RECENT_PRJ(NUMBER_OF_PROJECTS,:NEW.PROJECT_ID,EXISTING_PROJECT_ID,:NEW.UPDATED_BY,:NEW.CREATED_BY,:NEW.CREATED_ON);
EXCEPTION
WHEN NO_DATA_FOUND THEN
NVLX.PROC_USER_RECENT_PRJ(NUMBER_OF_PROJECTS,:NEW.PROJECT_ID,0,:NEW.UPDATED_BY,:NEW.CREATED_BY,:NEW.CREATED_ON);
END;
And this is the procedure which is inserting the data
CREATE OR REPLACE PROCEDURE PROC_USER_RECENT_PRJ (
NUMBER_OF_PROJECTS IN NUMBER,
NEW_PROJECT_ID IN PROJECT.PROJECT_ID%TYPE,
EXISTING_PROJECT_ID IN USER_RECENT_PROJECTS.PROJECT_ID%TYPE,
USER_NAME IN CONTENT_USER.USER_NAME%TYPE,
CREATED_BY IN PROJECT.CREATED_BY%TYPE,
CREATED_ON IN PROJECT.CREATED_ON%TYPE)
IS
MAX_RECENT_PROJECTS NUMBER := 5;
BEGIN
IF NUMBER_OF_PROJECTS<=MAX_RECENT_PROJECTS AND EXISTING_PROJECT_ID=NEW_PROJECT_ID THEN
UPDATE USER_RECENT_PROJECTS SET USER_RECENT_PROJECTS.UPDATED_ON=SYSDATE,USER_RECENT_PROJECTS.UPDATED_BY=USER_NAME WHERE PROJECT_ID=EXISTING_PROJECT_ID
AND USER_RECENT_PROJECTS.USER_NAME=USER_NAME;
ELSE IF NUMBER_OF_PROJECTS<MAX_RECENT_PROJECTS AND EXISTING_PROJECT_ID!= NEW_PROJECT_ID THEN
INSERT INTO USER_RECENT_PROJECTS VALUES (USER_NAME,NEW_PROJECT_ID,CREATED_BY,CREATED_ON,USER_NAME,SYSDATE);
ELSE IF NUMBER_OF_PROJECTS=MAX_RECENT_PROJECTS AND EXISTING_PROJECT_ID!= NEW_PROJECT_ID THEN
DELETE FROM USER_RECENT_PROJECTS WHERE USER_RECENT_PROJECTS.PROJECT_ID IN(
SELECT PROJECT_ID FROM USER_RECENT_PROJECTS
WHERE UPDATED_ON=(SELECT MIN(UPDATED_ON) FROM USER_RECENT_PROJECTS
WHERE USER_RECENT_PROJECTS.USER_NAME=USER_NAME));
INSERT INTO USER_RECENT_PROJECTS VALUES (USER_NAME,NEW_PROJECT_ID,CREATED_BY,CREATED_ON,USER_NAME,SYSDATE);
END IF;
END IF;
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NVLX.PROC_USER_RECENT_PRJ(NUMBER_OF_PROJECTS,NEW_PROJECT_ID,0,USER_NAME,CREATED_BY,CREATED_ON);
END PROC_USER_RECENT_PRJ;
Please help me on this issue.
Thanks in advance.....Thanks for your suggestion....
I am using the trigger for populating the data in USER_RECENT_PROJECTS.This
trigger is fired when data is INSERTED or UPDATED in PROJECT table.And that trigger will call the procedure PROC_USER_RECENT_PRJ.This is used
to put data in USER_RECENT_PROJECTS table.I am getting the problem in procedure the problem is upto five records it is inserting the record when i go for insert sixth record it should delete least UPDATED_ON and insert new record.But it is deleting the record from other user that i don't want.I want to delete the record from the paarticular user.I am using this query for deleting the record..
DELETE FROM USER_RECENT_PROJECTS WHERE USER_RECENT_PROJECTS.PROJECT_ID=(
SELECT PROJECT_ID FROM USER_RECENT_PROJECTS
WHERE UPDATED_ON=(SELECT MIN(UPDATED_ON) FROM USER_RECENT_PROJECTS WHERE USER_RECENT_PROJECTS.USER_NAME=USER_NAME)
AND USER_RECENT_PROJECTS.USER_NAME=USER_NAME
) AND USER_RECENT_PROJECTS.USER_NAME=USER_NAME;
when i fire this query individually it is deleting the proper record,but when i use it
inside procedure it is creating the problem it is deleting the record from other user.
Please suggest me other query for deletion.
Thanks in advance....... -
READ privileges for *all the databases*
Is it possible to grant READ privileges for all the databases objects (tables, schema, triggers, procedures, view and etc)
SHANOJ wrote:
Is it possible to grant privileges to all objects in one time?It depends on what you mean by 'in one time'. In one single SQL statement? No. But there's nothing stopping you issuing a billion grants one after the other in your session.
Roles are probably better suited for this task. But are you sure you really want to grant SELECT privileges on all the tables in the database? It's more common to grant SELECT on all the 'MARKAPP' tables to the 'MARKAPP_READ_ONLY' role... -
Sample report for filling the database table with test data .
Hi ,
Can anyone provide me sample report for filling the database table with test data ?
Thanks ,
Abhi.hi
the code
data : itab type table of Z6731_DEPTDETAIL,
wa type Z6731_DEPTDETAIL.
wa-DEPT_ID = 'z897hkjh'.
wa-DESCRIPTION = 'computer'.
append wa to itab.
wa-DEPT_ID = 'z897hkjhd'.
wa-DESCRIPTION = 'computer'.
append wa to itab.
loop at itab into wa.
insert z6731_DEPTDETAIL from wa.
endloop.
rewards if helpful -
How to write select query for all the user tables in database
Can any one tell me how to select the columns from all the user tables in a database
Here I had 3columns as input...
1.phone no
2.memberid
3.sub no.
I have to select call time,record,agn from all the tables in a database...all database tables have the same column names but some may have additional columns..
Eg: select call time, record,agn from ah_t_table where phone no= 6186759765,memberid=j34563298
Query has to execute not only for this table but for all user tables in the database..all tables will start with ah_t
I am trying for this query since 30days...
Help me please....any kind of help is appreciated.....Hi,
user13113704 wrote:
... i need to include the symbol (') for the numbers(values) to get selected..
eg: phone no= '6284056879'To include a single-quote in a string literal, use 2 or them in a row, as shown below.
Starting in Oracle 10, you can also use Q-notation:
http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/sql_elements003.htm#i42617
...and also can you tell me how to execute the output of this script. What front end are you using? If it's SQL*Plus, then you can SPOOL the query to a file, and then execute that file, like this:
-- Suppress SQL*Plus features that interfere with raw output
SET FEEDBACK OFF
SET PAGESIZE 0
-- Run preliminary query to generate main query
SPOOL c:\my_sql_dir\all_ah_t.sql
SELECT 'select call time, record, agn from '
|| owner
|| '.'
|| table_name
|| ' where phone_no = ''6186759765'' and memberid = j34563298'
|| CASE
WHEN ROW_NUMBER () OVER ( ORDER BY owner DESC
, table_name DESC
) = 1
THEN ';'
ELSE ' UNION ALL'
END AS txt
FROM all_tables
WHERE SUBSTR (table_name, 1, 4) = 'AH_T'
ORDER BY owner
, table_name
SPOOL OFF
-- Restore SQL*Plus features that interfere with raw output (if desired)
SET FEEDBACK ON
SET PAGESIZE 50
-- Run main query:
@c:\my_sql_dir\all_ah_t.sql
so that i form a temporary view for this script as a table(or store the result in a temp table) and my problem will be solved..Sorry, I don't understand. What is a "temporary view"? -
What is the Table/View name for getting the Database Object Dependencies
I am running the Database Object Dependencies report to get the reference of Database Object and their respective Application Component.
Applications xxxx -> Application Reports -> Shared Components -> Database Object Dependencies -> Compute Dependencies
I want to develop a report for the same purpose, Just want to know what is the APEX Tables / Views they are using to run this report, so that I can use the same Tables to create my own report.
Thanks,
DeepakHi Andy,
when I am using the following query...I am not getting any result...
select name, type, owner
from all_dependencies
where referenced_owner = 'APEX_030200'
and referenced_name = 'WWV_FLOW_PATCHES'
AND OWNER= 'XXXXXXX' --- (addeed this to the where clause)
I modified the query.....I am getting the result.....
select name, type, owner
from all_dependencies
AND OWNER= 'XXXXXXX'
- But I am not getting which database object(table/view) is using which Application Page/Component like we have in Database Object Dependencies.
- Also what is this REFERENCE OWNER & REFERENCE_NAME ----
referenced_owner = 'APEX_030200'
and referenced_name = 'WWV_FLOW_PATCHES'
I am little bit confused, Can you pl expalin me in details......
Thanks,
Deepak -
Where to find the resolved query sent to the database?
Verison 4.1.1.00.23
Hello,
Where/How do I find the actual query that is sent to the database? I've enabled Debug on the Dev Toolbar, but I still don't see where the query that is sent to the database is at? I'm hoping to see a view with the page items resolved not what is actually in the page.
I have a query on a collection and I keep getting a 'SQL command not properly ended' error and I'm not seeing why it's not "properly ended".
Hope this is clear.
Let me know if not.
Thanks,
JoeTony,
Thank you for replying.
There is an update - The query no longer throws the 'SQL command not properly ended', but now it throws the dreaded 'Missing Right Parenthesis' error.
The query is:
APEX_COLLECTION.CREATE_COLLECTION_FROM_QUERY_B (p_collection_name => 'TEAM_EMP',
p_query => 'SELECT cme_system, tbs_team_id, resource_id,
CASE WHEN resource_type = ''C'' THEN ''Consultant'' ELSE ''Employee'' END AS resource_type, role,
jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec, forecast_id, project_id,
jan_id, feb_id, mar_id, apr_id, may_id, jun_id, jul_id, aug_id, sep_id, oct_id, nov_id, dec_id,
resource_name, tbs_forecast_year.last_updated, last_updated_by.last_updated_by, area_id, p.group_id, team_name,start_date, end_date, p.project_name
FROM tbs_forecast_year
INNER JOIN (SELECT project_id pid, area_id, tbs_projects.group_id, UPPER(project_name) project_name
FROM tbs_projects
WHERE status IN (''Pipeline'', ''Planned - Partially Funded'', ''Planned'', ''Execution'')) p
ON p.pid = project_id
LEFT JOIN (SELECT resource_onepass_id, resource_name last_updated_by
FROM resources where resource_onepass_id is not null) last_updated_by
ON last_updated_by.resource_onepass_id = tbs_forecast_year.last_updated_by
LEFT JOIN tbs_teams ON tbs_teams.team_id = tbs_team_id
LEFT JOIN (SELECT resources.resource_id rid, resource_name from resources) resources
ON rid = resource_id
WHERE (jan > 0 OR feb > 0 OR mar > 0 OR apr > 0 OR may > 0 OR jun > 0 OR jul > 0 OR aug > 0 OR sep > 0 OR oct > 0 OR nov > 0 OR dec > 0)
AND forecast_type = ''Supply''
AND (project_id = '|| :F189_PROJECT_ID ||' OR 0 = '||:F189_PROJECT_ID ||')
AND (tbs_team_id IN (SELECT * FROM the(SELECT cast(vc2_list('|| :F189_TEAM_ID ||') as vc2_list_type) FROM dual))
OR 0 IN (SELECT * FROM the(SELECT cast(vc2_list('|| :F189_TEAM_ID ||') as vc2_list_type) FROM dual)))
AND (resource_id = '|| :F189_RESOURCE_ID ||' OR 0 = '||:F189_RESOURCE_ID ||')
AND (team_name like ''%'|| :F189_TEAM_NAME ||'%'' OR '' '' = '' '||:F189_TEAM_NAME ||''')
AND (area_id = '|| :F189_AREA_ID ||' OR 0 = '||:F189_AREA_ID ||')
AND NOT (0 = '||:F189_RESOURCE_ID ||' AND 0 = '||:F189_AREA_ID ||' AND 0 IN (SELECT * FROM the(SELECT cast(vc2_list('||:F189_TEAM_ID||') as vc2_list_type) from dual))
AND 0 = '||:F189_PROJECT_ID ||' AND '' '' like '' %'||:F189_TEAM_NAME ||'%'')
Line 22 is calling a function to deal with a Multi-Select list that I found https://community.oracle.com/message/3566187#3566187. I've created the TYPE and the function as indicated in that thread. The error is thrown when multiple Team's are selected.
The exact error is: create_collection_from_query_b Error:ORA-20104: create_collection_from_query ParseErr:ORA-00907: missing right parenthesis
There are going to be 4 multi-select lists and TEAM_ID is the first.
:F189_TEAM_ID is an application item that is being populated from a page process.
If you have a better solution for dealing with Multi-Select lists I would be very interested in hearing it.
I've tried the replace and the instr methods with no success. Once the Collection is working then I have to modify the query for the page which is using the APEX_ITEM API's, but I haven't gotten this working yet.
Thanks Tony!
Joe -
Query to track the holder and waiter info
Hi All,
I have framed the following query to get the blocker and holder info.
I intend to use this query in a auto-generated mail which executes every 15 mins
I have put an outer join on the holder because the holder DML might have completed its execution (v$sqlarea might not have info about this holder DML) at the time the auto mail configuration fires this query
I am not a dba and was apprehensive if there is some mistake in the logic of my query.
I was also expecting to join v$sql_bind_capture using sql_hash_value and sql_address just the way in which I have joined v$sqlarea
Looking forward to your kind help in vetting the below query
Select distinct waiting_session,
dba_waiters.holding_session,
decode(to_char(session_waiting_info.STATE),'0','waiter is currently waiting','-2','duration of last wait by waiter is unknown','-1','waiter waited for a short time',' waiter waited long time') "waiters waiting state",
decode(session_waiting_info.WAIT_TIME,0,'waiter waiting') "waiters last wait time",
decode(to_char(session_holding_info.STATE),'0','holder is currently waiting','-2','duration of last wait by holder is unknown','-1','holder waited for a short time','holder waited long time') "holders waiting state",
decode(session_holding_info.WAIT_TIME,0,'waiter waiting') "holders last wait time",
sql_waiting_info.sql_text "query of the waiter",
sql_holding_info.sql_text "query of the holder",
session_waiting_info.STATUS "waiting STATUS",
session_holding_info.STATUS "holding STATUS",
session_waiting_info.process "waiting process",
session_waiting_info.PROGRAM "waiting PROGRAM",
session_holding_info.process "holding process",
session_holding_info.PROGRAM "holding PROGRAM",
session_waiting_info.ROW_WAIT_OBJ# "waiting object",
session_waiting_info.ROW_WAIT_ROW# "waiting row",
session_holding_info.ROW_WAIT_OBJ# "holding object",
session_holding_info.ROW_WAIT_ROW# "holding row",
session_waiting_info.BLOCKING_SESSION_STATUS "waiting session status",
session_holding_info.BLOCKING_SESSION_STATUS "holding session status",
session_waiting_info.username "holding os username",
session_holding_info.username "waiting os username",
session_waiting_info.MACHINE "waiting MACHINE",
session_waiting_info.TERMINAL "waiting TERMINAL",
session_holding_info.MACHINE "holding MACHINE",
session_holding_info.TERMINAL "holding TERMINAL",
session_waiting_info.TYPE "waiting TYPE",
session_holding_info.TYPE "holding TYPE"
from dba_waiters,
v$session session_holding_info,
v$session session_waiting_info,
v$sqlarea sql_waiting_info,
v$sqlarea sql_holding_info
Where dba_waiters.waiting_Session = session_waiting_info.sid
and dba_waiters.holding_Session = session_holding_info.sid
And session_waiting_info.sql_hash_value = sql_waiting_info.hash_value
And session_waiting_info.sql_address = sql_waiting_info.address
and session_holding_info.sql_hash_value = sql_holding_info.hash_value(+)
And session_holding_info.sql_address = sql_holding_info.address(+)
and dba_waiters.mode_held 'None'
Regards,
VishalHi Jonathan,
I have tried to incorporate your suggestions in the below query. Please let me know about the problems that the below query suffers from
select session_waiting_info.BLOCKING_SESSION,
waiter.sid waiting_session,
waiter.SECONDS_IN_WAIT,
decode(session_holding_info.STATE,'WAITED SHORT TIME','Holder did not wait and is currently '||session_holding_info.STATUS,'WAITING','Holder is also waiting for the past '||session_holding_info.SECONDS_IN_WAIT ||' seconds','WAITED UNKNOWN TIME','Duration of last wait of holder is unknown','WAITED KNOWN TIME','Duration of last wait by the holder is:'||session_holding_info.STATE || ' and is currently '||session_holding_info.STATUS) "State of holder",
sql_waiter_info.SQL_TEXT,
bind_values.NAME,
bind_values.VALUE_STRING,
session_waiting_info.STATUS "waiting STATUS",
session_waiting_info.username "holding os username",
session_holding_info.username "waiting os username",
session_waiting_info.STATUS "waiting STATUS",
session_waiting_info.process "waiting process",
session_holding_info.process "holding process",
session_waiting_info.PROGRAM "waiting PROGRAM",
session_holding_info.PROGRAM "holding PROGRAM",
session_waiting_info.ROW_WAIT_OBJ# "waiting object",
session_waiting_info.ROW_WAIT_ROW# "waiting row",
session_holding_info.ROW_WAIT_OBJ# "holding object",
session_holding_info.ROW_WAIT_ROW# "holding row",
session_waiting_info.sql_id,
session_waiting_info.SQL_CHILD_NUMBER
from V$SESSION_WAIT waiter,
V$SESSION session_holding_info,
V$SESSION session_waiting_info,
V$SQLSTATS sql_waiter_info,
V$SQL_BIND_CAPTURE bind_values
where waiter.sid = session_waiting_info.sid
and session_waiting_info.BLOCKING_SESSION = session_holding_info.sid
and session_waiting_info.sql_id = sql_waiter_info.sql_id
and session_waiting_info.sql_id = bind_values.sql_id(+)
and session_waiting_info.SQL_CHILD_NUMBER = bind_values.CHILD_NUMBER(+)
and waiter.WAIT_TIME = 0
Regrds,
Vishal -
FM for tracking the changes in materail master
Hi Experts,
I want to track the changes done to a material ( like if there are changes to materail description and materail group etc., ) for a given date. Is there any FM which can take the maerail number as input and give out these details. I know MM02 but I need to have an explicit FM to get these details.
thanks
sankarHi dieter,
Thanks for ur reply.
If I want to check for the chage of a particular field.. for exmaple material description or material group. In CDPOS it is giving the table names only. How do i know which field is exactly changed.
thanks
sankar -
Hi There,
We have a table in Database with Columns ( Installed, Removed, Transaction Date ) , that table tracks the Parts when it is installed in store and when that part was removed from store with Transaction Dates
So from below example how to get the "Part A" install and Removal Dates ?
Please Help !!
Thanks,
Learning Bee !!
Dotnet.ExplorerPlease try this code:
IF OBJECT_ID('dbo.Track') IS NOT NULL
DROP TABLE dbo.Track;
GO
CREATE TABLE dbo.Track
Installed NVARCHAR(10) ,
Removed NVARCHAR(10) ,
TransactionDate INT
GO
INSERT INTO dbo.Track
( Installed, Removed, TransactionDate )
VALUES ( N'Part A', NULL, '2007' ) ,
( N'Part X', N'Part A', '2008' ) ,
( N'Part A', N'Part X', '2009' ) ,
( N'Part Y', N'Part A', '2010' ) ,
( N'Part A', N'Part Y', '2011' );
GO
WITH NewTrack
AS ( SELECT * ,
ROW_NUMBER() OVER ( ORDER BY TransactionDate ) AS Rn
FROM dbo.Track
SELECT T1.Installed AS Part ,
T1.TransactionDate AS [Installed Date] ,
T2.TransactionDate AS [Removerd Date]
FROM NewTrack AS T1
LEFT JOIN NewTrack AS T2 ON T1.Installed = T2.Removed
AND T2.Rn = T1.Rn + 1
ORDER BY Part ;
T-SQL Articles
T-SQL e-book by TechNet Wiki Community
T-SQL blog -
Creating .bat for analyzing the Database.
Hi Experts,
I am having a doubt in scheduling database analysis process windows 2003 server.
Every Sunday, we have to schedule the database analysis. just view the below example
sysuser login id : testlogin
sysuser password: demotest
connection string: demotest
file - demo.sql is available in d:\
Now i need to create a .bat file for scheduling purpose.
in the bat file, i want to connect as sysuser and then execute the above mentioned sql file. please suggest me how to give the syntax for connecting to oracle database as sysuser through a .bat file.
One more doubt: we have to analyze the database in sysuser mode only or also in local user mode???
suggest me about this...
Thanks in Advance.oracle recommends generation of statistics using dbms_stats package with
dbms_jobs package.
You can use following procedure as sys user
variable jobno number;
variable instno number;
begin
select instance_number into :instno from v$instance;
dbms_job.submit(:jobno, 'dbms_stats.GATHER_SCHEMA_STATS(ownname=>'<schema Name>,OPTIONS=>''GATHER'',cascade=>TRUE);', TO_DATE('18-JUN-05--21','DD-MON-YY--HH24'), '(SYSDATE+1)', TRUE, :instno);
commit;
end;
/
Maybe you are looking for
-
What's Happened To Mountain Lion??
I've had to completely re-build my i-Mac after a download of OS 9 Mavericks destroyed my system. (As many people are reporting, see all the 'one-star' reviews on the Mavericks page at Apple). I re-installed 10.6. Snow Leopard - for which I had the d
-
ASYNC to SYNC scenario using BPM.
hi, i have a async to sync scenario. i have a File sender->PI(BPM)->ECC and the response from ECC->PI->SOAP. Here in PI, i am using BPM. The ECC side is a Synchronous BAPI. The response is sent to the SOAP receiver. in BPM, can someone tell me how ma
-
What is the best format and page weight for graphics?
The Apple support adviser suggested that I ask this question here. I am creating a presentation that will be shown with varying kinds of monitors and projectors. I want to be sure that my graphics are clear and easy to read. How much does page weight
-
HT1414 I never set a restrictive password, what do I do to find it?
I have never set a restrictive password and I don't know what to do. I have a four digit password for something else on my ipad but that one doesn't work on the restrictive one......HELP!
-
How important is GPU acceleration in FCPX/Motion 5?
So I've been using FCPX and Motion5 on an old mac (mid-2010 iMac, i3 dual core) at work (self taught - 3-6 minute promos and tutorial vids for our web services, not remaking Blue Planet or anything!), and as an Apple Convert I want to replace my home