Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Table export into pivot table

KaupoFeb 4 2017 — edited Feb 7 2017

Dear all,

Im not a programmer nor specialist in databes. Yet I do have some experiences.

I have a medical workstation which has no effective user activity log output. Still in our region its mandatory to log user activity as long we keep the studies.

As vendor has no good solution, one way would be to go into database tables and create the query for 2 tables I need with necessary info, like this:

select /*CSV*/ DATE_TIME_CREATED,TO_CHAR(TO_DATE('19700101000000','YYYYMMDDHH24MISS')+((DATE_TIME_CREATED+7200)/(86400)),'YYYY-MM-DD HH24:MI') minute,
USER_ID,EVENT_TYPE,OBJECT_TYPE, OBJECT_REF,IDENTIFIER,SOURCE,DESTINATION,NUM_OBJECTS,EVENT_INFO,VIEWED,PATIENT_ID,DATA_ID,MACHINE_ID,SENT_TO_ARR
from mvf.map_event_auditĀ 

UNION ALL


select /*CSV/ DATE_TIME_CREATED,TO_CHAR(TO_DATE('19700101000000','YYYYMMDDHH24MISS')+((DATE_TIME_CREATED+7200)/(86400)),'YYYY-MM-DD HH24:MI') minute,

USER_ID,EVENT_TYPE,OBJECT_TYPE, OBJECT_REF,IDENTIFIER,SOURCE,DESTINATION,NUM_OBJECTS,EVENT_INFO,VIEWED,PATIENT_ID,DATA_ID,MACHINE_ID,SENT_TO_ARR
from mvf.MAP_EVENTĀ 

order by 1 desc;


This one works well in sql developer giving a needed output. Yet I would like to make it work as automatic pivot table. Meaning, to create this query run per month into a pivot table (to make client easy way to choose the information) and be named by month and year.

I know there are also external tools for different jobs etc... Yet would it be possible to make such a task automatic inside of DB itself?

Thankfully,

Kaupo

***Moderator action (Timo): removed private contact data as this is not allowed here.***

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 7 2017
Added on Feb 4 2017
6 comments
521 views