Need output format for trigger  program

Hello everyone ;
https://forums.oracle.com/message/11078921#11078921
Above link is reference . It's also my own thread related to   this discussion.
SQL> desc user_login
Name                                                              Null?    Type
USERNAME                                                                VARCHAR2(30)
ISDBA                                                                          VARCHAR2(20)
LOGIN_DATE                                                              DATE
LOGIN_TIME                                                               VARCHAR2(15)
LOGOUT_TIME                                                          VARCHAR2(15)
EXTERNAL_NAME                                                     VARCHAR2(30)
AUTHENTICATION_TYPE                                          VARCHAR2(30)
HOST                                                                          VARCHAR2(20)
Program for tracing user logon/logoff  details
SQL> create or replace  trigger  tri_logon
AFTER LOGON ON DATABASE
BEGIN
INSERT  INTO  user_login (username, isdba, external_name,
authentication_type, HOST,  login_date , login_time)
SELECT SYS_CONTEXT ('USERENV', 'SESSION_USER'),
SYS_CONTEXT ('USERENV', 'ISDBA'),
  SYS_CONTEXT ('USERENV', 'EXTERNAL_NAME'),
  SYS_CONTEXT ('USERENV', 'AUTHENTICATION_TYPE'),
  SYS_CONTEXT ('USERENV', 'host'),
  SYSDATE, TO_CHAR (SYSDATE, 'HH24:MI:SS') FROM DUAL;
   END;
Trigger  created.
SQL> create or replace trigger tri_audit1
2 BEFORE LOGOFf on database
3   BEGIN
4 insert into user_login (username, logout_time)
5 (select user, TO_CHAR(SYSDATE, 'HH24:MM:SS') from dual);
6 end;
6 /
Trigger  created.
I got following output . Here i cannot insert logout_time on logout_time column.
logout_time is dispalyed seperately please see last two output values  (CST01 ,  02:06:16)   and  user_name also displayed twice.  (don't  need )
USERNAME   ISDBA   LOGIN_DAT   LOGIN_TIME   LOGOUT_TIME   EXTERNAL_NAME AUTHENTICATION_TYPE  HOST
CST01           FALSE     21-JUN-13          02:06:11                                            oracle                            DATABASE                            linuxserver     CST01    02:06:16
I want output following  below  format
Expecting output  logout time  on  LOGOUT_TIME column  and   user_name  should be displayed once.
USERNAME ISDBA LOGIN_DAT LOGIN_TIME   LOGOUT_TIME   EXTERNAL_NAME  AUTHENTICATION_TYPE HOST
CST01      FALSE       20-JUN-13       13:06:34                                            oracle                       DATABASE                   LINUXSERVER
thanks in advance ..

8f953842-815b-4d8c-833d-f2a3dd51e602 wrote:
Hello everyone ;
https://forums.oracle.com/message/11078921#11078921
Above link is reference . It's also my own thread related to   this discussion.
SQL> desc user_login
Name                                                              Null?    Type
USERNAME                                                                VARCHAR2(30)
ISDBA                                                                          VARCHAR2(20)
LOGIN_DATE                                                              DATE
LOGIN_TIME                                                               VARCHAR2(15)
LOGOUT_TIME                                                          VARCHAR2(15)
EXTERNAL_NAME                                                     VARCHAR2(30)
AUTHENTICATION_TYPE                                          VARCHAR2(30)
HOST                                                                          VARCHAR2(20)
In addition to the myriad of other issues pointed out in this and your other -- essentially duplicate -- thread, why do you have separate columns for login_date and login_time?  A DATE datatype (which you have correctly defined for LOGIN_DATE carries both date and time elements.  You only need one column -- LOGIN_TIME -- populated with SYSDATE when the user logs in.  And LOGOUT_TIME should also be a DATE, populated with SYSDATE.  This alone points to several design flaws.
1) DATE and TIME are not seperate elements.  In this application, the concept of 'time' has no meaning apart from the date, and a DATE data type, by definition, stores both date and time.
2) keeping either date OR time in a varchar is asking for trouble.  Comparisons and math simply do not work as you expect.
3) You don't have a date for LOGOUT, but suppose the user logs on at 2330 on Tuesday, and logs out at 0030 on Wednesday..
Properly, you should only have two columns for this .. LOGON_TIME, defined as a DATE, and LOGOUT_TIME, defined as a date.
Or possibly separate rows, one for LOGON and one for LOGOUT, both with a sessid to join them.
Or better, and as I mentioned earlier, don't reinvent what AUDIT already does.  How much time have you spent on this (how much of your employers MONEY has been spent) when you could have solved the whole thing in 5 minutes with AUDIT?
Program for tracing user logon/logoff  details
SQL> create or replace  trigger  tri_logon
AFTER LOGON ON DATABASE
BEGIN
INSERT  INTO  user_login (username, isdba, external_name,
authentication_type, HOST,  login_date , login_time)
SELECT SYS_CONTEXT ('USERENV', 'SESSION_USER'),
SYS_CONTEXT ('USERENV', 'ISDBA'),
  SYS_CONTEXT ('USERENV', 'EXTERNAL_NAME'),
  SYS_CONTEXT ('USERENV', 'AUTHENTICATION_TYPE'),
  SYS_CONTEXT ('USERENV', 'host'),
  SYSDATE, TO_CHAR (SYSDATE, 'HH24:MI:SS') FROM DUAL;
   END;
Trigger  created.
SQL> create or replace trigger tri_audit1
2 BEFORE LOGOFf on database
3   BEGIN
4 insert into user_login (username, logout_time)
5 (select user, TO_CHAR(SYSDATE, 'HH24:MM:SS') from dual);
6 end;
6 /
Trigger  created.
I got following output . Here i cannot insert logout_time on logout_time column.
logout_time is dispalyed seperately please see last two output values  (CST01 ,  02:06:16)   and  user_name also displayed twice.  (don't  need )
USERNAME   ISDBA   LOGIN_DAT   LOGIN_TIME   LOGOUT_TIME   EXTERNAL_NAME AUTHENTICATION_TYPE  HOST
CST01           FALSE     21-JUN-13          02:06:11                                            oracle                            DATABASE                            linuxserver     CST01    02:06:16
I want output following  below  format
Expecting output  logout time  on  LOGOUT_TIME column  and   user_name  should be displayed once.
USERNAME ISDBA LOGIN_DAT LOGIN_TIME   LOGOUT_TIME   EXTERNAL_NAME  AUTHENTICATION_TYPE HOST
CST01      FALSE       20-JUN-13       13:06:34                                            oracle                       DATABASE                   LINUXSERVER
thanks in advance ..

Similar Messages

  • How we can get the output in excel format for Spawned programs?

    My requirement is to get the excel output for some of the programs (like -Adjustment Register, Applied Receipts Register). I am trying to achieve this by BI Publisher. But these programs has "Spawned" executable. And when I am changing the output type as"XML" I am getting below error in output-
    "XML Parsing Error: syntax error"
    Can anyne suggest how we can get an XML output and then excel output for Spawned programs?
    Thanks in advance,

    Hi,
    If I get it right, you want to convert RXi (Reports Exchange) reports such as Adjustment Register & Applied Receipts Register into XML Publisher. Normally, you need to change the "Output Format" of the program called by the "Spawned" program to 'XML' -- not the "Spawned" program itself.
    However, I believe RXi reports does not support XML output (atleast in 11i). It could only work on Text & Html format. Check on the metalink note below:
    432719.1 - RXi-Only Reports Generate XML Format Exception With No Output Setting the Output Format to XML
    Hope this helps.
    regards,..
    Rownald

  • Change Output format of standard program RFSZIS00

    Hi All,
    I want to change output format of standard program RFSZIS00 for this i copied this into Z program but i am not able to
    find out where final output table is populating because that program is not using any final internal table it's using EXRACT and
    another thing is all discription for field has given in German Language.
    It's a clasical report not an ALV.
    Edited by: Raj Singh on Jul 3, 2009 11:03 AM

    Dear Raj,
    as per the report mentioned by you, it is calling some subroutine to display the details.
    Just try to trace the WRITE statements and check if you can add your own include in this report to display the output as per your requirement.
    Regds,
    Anil

  • How to get multiple output formats for each execution of the report?

    Hi,
    Is it possible to get multiple output formats for each execution of the report? If so can you provide some details?
    Thanks

    In Reports 6i, Reports Distribution was introduced. This allows you to run the report once and output to a number of destinations with a different format. It also allows you to distribute individual sections within a report to different destinations in different formats.
    The Destinations for a Report to distribute to are defined either in a distribution file and passed on the command line or inside of the report definition.
    To add a destination to the the report definition, bring up the property palette against the report object and then select the "Distribution" property under the "Report" node. This will bring up a dialog that allows you to create a distribution list. You can then test this list by selecting "file->distribute" from the menu.
    To run a report that is to be distributed through rwrun60, you need to add "distribute=yes" to the command line. It will pick up the destinations from the report definition. If you add "destination=<filename>" then it will pick up the destinations from the specified "<filename>" and ignore the destinations in the report definition.
    Note: if "distribute=yes" is specified on the command line then the destype/desname/desformat parameters will be used to format the report (ie: which printer/display to use during formatting for sizing objects) but will be ignored when the report is sent to the destinations.

  • IPod is formatted for windows but i need it formatted for mac

    i just got my iPod a couple days ago used from best buy and hooked it up from my mac not aware that it was formatted for windows. when i try to restore my iPod it just freezes up my computer. do i really need it formatted for mac in order to get good performance?

    Right. If you restored it in Windows the iPod will still be formatted for Windows.
    Now see if you can restore it on your mac.
    Also, know that Windows-formatted iPods work fine in Mac OS X. The only "problem" is that you cannot update the iPod's software on your mac if another software version is released. You would have to do that through Windows.
    If you plan on using your iPod with both Operating Systems, you may want to keep it formatted for Windows.
    btabz

  • 57F4 Print Output format for Subcontracting

    1. How to assign Print out put format for goods issue made against a subcontracting vendor
    2. How to assign print output format for 57F4 Subcontracting challan
    3. What are CIN settings for subcontracting po.

    Hi,
    Maintain the Outout type J1IF for the excise group - SPRO - IMG - Logisitics general - Tax on goods & movements - India - Business transactions - Subcontracting - Maintai subcontracting attributes
    check following link
    [http://wiki.sdn.sap.com/wiki/display/ERPLO/SubcontractingChallan57F4_J1IF01_J1IF11]
    Regards
    Kailas Ugale

  • Best Output Format for Slide Show?

    If I were to purchase Final Cut Studio...
    What would be the best output format to use for a simple slideshow intended for Web deployment? In other words, which encoding method will provide the best compromise between file size and video quality? The slideshow is a series of simple static images with some fade transitions and Ken Burns effects. There is also a soundtrack for background music.
    A 1.5 minute slideshow with soundtrack created using Adobe Flash is less than 2 MB in size (which is great for Web deployment), and it looks very good. If that same slideshow is exported from Flash to a QuickTime-compatible format, it balloons to over 20 MB!
    So what I'd really like to know is, if something like Final Cut Pro were used to create that same slideshow, would I be able to produce a web-ready video that rivals the Flash version in size?
    Thanks for any help and insight you can provide,
    -Steve

    Studio X wrote:
    Quicktime is a file wrapper that can contain anyone of a number of codecs.
    Yes, I understand that.
    H.264 is the prefered version for web/apple TV delivery.
    A 90s slideshow that was less than 2 MB as a SWF file became a 27 MB behemoth when exported using the H.264 codec. The exported file had the same frame rate and resolution (pixel dimensions) as the original Flash file. The audio was optimized as well. Why the dramatic difference? (I think I know why, but perhaps I'm missing something.)
    That being said, Final Cut Pro is a video editing program and is a waste of money if all you are doing is simple slideshows.
    Slideshows are not all I will be doing, but I will be doing them occasionally, and it's hard to justify purchasing Flash just to create slideshows that are optimized for the Web.
    Have you tried iMovie then converting the output to either Flash or (if you have Quicktime Pro) converting to h.264 QT?
    My tests indicate that anything but Flash format results in a monstrous file for a simple slideshow. I have a notion as to why this is, but I wanted to check to make sure that I'm not overlooking some way of creating smaller non-Flash files.
    The bottom line is that Final Cut Studio will be far more useful and versatile for what I need to do, and I would be much more proficient with that software; but if I can't output video files that rival those of Flash in terms of quality and file size, then I might have to get a copy of Flash after all.
    And yes, you can convert a QuickTime movie to flash, but it's just not the same in terms of file size as generating the same slideshow directly in Flash. I suspect this is because Flash is optimized for animation, whereas the QuickTime codecs are designed for video, and a simple slideshow is more of an animation than a video.
    So my real question is (and I suspect the answer is no), is it possible using Final Cut Studio to generate a simple slideshow which rivals the output from Flash in terms of file size for a given resolution?
    -Steve

  • Output Format for Currency

    Hi There,
    I have set defaults as '1,000.00' for currency output in the own data but in the output of report it is showing like '1.000,00'.
    PS: there is no formating statement in the program as well.
    Any advice friends, how can I make it in required format.
    Regards,
    Shabbar

    HI ali ,
    yeah u can do thi sin scripts ..
    take a look at this ..
    Country-Dependent Formatting: SET COUNTRY The formatting for certain field types depends on the country settings. These field types include, for example, date fields and number fields that include either a decimal point or the ‘thousands’ separator character. The formatting options defined in the user master record are usually the ones used here. To choose a formatting option other than the one specified in the user master record, use the SET COUNTRY control command. The country-dependent formatting options are stored in the T005X table. Syntax: /: SET COUNTRY country_key You can enter the country key either as a literal value enclosed in quotes or as a symbol.
    /: SET COUNTRY 'CAN' /: SET COUNTRY &country_key& Use a blank country name to revert to the setting found in the user master record: /: SET COUNTRY ' ' This SAPscript command actually calls the corresponding ABAP command internally. This guarantees the effect of the SAPscript command to be identical with that of the ABAP command
    regards,
    VIjay
    Message was edited by:
            vijay k

  • Changing output format for iTunes conversions

    WHen I convert my WMA files, iTunes converts them as quicktime files. When I play music through my laptop I prefer to us Windows Media Player though, not quicktime.
    Does anyone know if I can change the output format in iTunes to change them from WMA to MP3 instead of quicktime?
    thankyou

    When you import a wma file into iTunes, it makes a copy of the file converting it to either MP3 or AAC according to how you have set your preferences in Edit>>Preferences>>Advanced>>Importing.
    You want the drop down box labelled "Import Using".
    The actual program used to play the file depends on how you have your file associations set. You can change this by right clicking on a file and selecting "Open with" >>Choose Program. You select the program you want to use (assuming it knows how to play the file) and also ensure the "Always use selected program..." check box is ticked.
    The original wma file is left intact, so unless you delete it, it will be available to use in WMP. If you don't want to do that, and you want to use WMP as your player, you need to import into iTunes as MP3 rather than AAC.

  • Output Format for Amount in SAP Script PO

    Hi,
    In my Standard SAP Script PO Form 'MEDRUCK', all amount values are getting printed in the form 1.234.567,89 but I want them to be in the Form 1,234,567.89 .
    For doing this I have gone in T-Code SU3 and set the default decimal notation as
    X 1,234,567.89 . 
    I have also tried by giving the command
    /: SET COUNTRY 'IN'
    But still the amounts in the ouput format is coming in the same way 1.234.567,89 .
    If anyone has faced similar situation, plz tell how to change the output format of amount in SAP Script.
    Thanks and Regards,
    Nitin Gupta

    I have tried using SU3 but it's not worknig. Is their any other method also of which maybe I am not aware of?

  • SMTP - Output Formats for RAW Text

    Hi,
    I am trying to set the output format in transaction SCOT for RAW Text. I want to set the format to HTM. However, HTM does not exist in the dropdown menu. Does anyone know how I can get HTM as an option for RAW Text?
    Thanks
    /Elvez

    Hi Elvez,
    Check note 698124 SAPconnect: Customer-specific format conversion, let me know if it
    solved your request ?
    Ari

  • Originally formatted for mac....need to format for pc Help!

    Hi,
    My original ipod (scroll wheel) was formatted for a mac.
    I no longer have a mac. I need to reformat for pc. I am unable to find any info in troubleshooting etc. Please help.
    Thanks,
    Phil

    Just Restore it on the PC.

  • What is the possible output format for a BAPI  ?

    Can anybody tell me what is the possible output format of a BAPI.
    What happens when a BAPI excecutes ?
    thanks

    Hi,
    All the output message/feedback about a trasaction are stored in the RETURN parameter table .
    You can read that RETURN internal table using "format message" or "Read_Text" Fucntion modules.
    Thanks
    Dany

  • Adobe Story Free needs a format for American sitcoms, not just UK

    Why in the world would you not include a format for American sitcoms in the TV scripts? I have no clue what I'm looking at with the UK script format, what with everything centered and weird looking.

    Thanks for the info ... yea, that wouldn't look the same, would it?
    As to language ... I've heard a couple different English linguistic historians ... from England ... who are really considered the top experts in their field, talk about language form, syntax, and spoken ... "feel and sound", and there comments had me rolling on the floor. My daughter took a serious English/language class on linguistic history, and says that no matter the hilarity it may induce, the dudes are probably spot-on.
    They felt that the Boston area ... particularly a couple rural "parishes" as they put it ... have a far closer native syntax than anything currently in use in England. But for total similarity, get this ... go to the most remote Appalachian villages and hamlets and rural houses in southern West Virginia down through the western tip of Virginia and into nw-North Carolina and far ne-Tennessee, and get the most un-educated, least tv-aware people there, and you've probably got the closest to the way "Midsummer's Night's Dream", "Hamlet", and Willie's other plays actually sounded in first performances at the Globe.
    Can you imagine staging "Othello" in the London theatre district with everyone speaking hillbilly-ese?
    Neil

  • Need the format for input file for standard program

    hi can any one please give me the format in which the file to be uploaded to program RFBIBL00 ,
    must be in for example my excel file to be uploaded has the following columns.
    company code
    accounting doc
    line item
    fiscal year
    doc type
    doc date
    so is there any program which can create a file in the format to be uploaded taking this excel sheet.
    i read the documentation but i am little confused about that.
    thank you.

    Ok.. I have created one small test program for RFBIBL00.
    That program uses this file format:
    indicator     company code      fiscal year      doc type      doc date     positng date     header text     Account     posting key      amount      item text      assignment number ....
    H     0001     2007     SA     11/21/2007     11/21/2007     Test from RFBIBL00                         
    D                                   106210     40     123.3     Line 1     
    D                                   106210     50     123.3     Line 2     
    H     0001     2007     SA     11/21/2007     11/21/2007     Test from RFBIBL00                         
    D                                   106210     40     123.3     Line 1     
    D                                   106210     50     123.3     Line 2     
    Copy this data into one notepad and save it as .txt file. you need to provide this path to the test program.
    The source code of the program (Currently it is only test version):
    *& Report  ZTEST_NP_RFBIBL00
    REPORT  ZTEST_NP_RFBIBL00.
    TABLES:  BGR00,                        " Batch-Input Mappendaten
             BBKPF,                        " Batch-Input Tcode + Belegkopf
             BBSEG,                        " Batch-Input Belegsegment
             BBTAX,                        " Batch-Input Belegsteuern
             BSELK,                        " Batch-Input Selektionskopf
             BSELP.                        " Batch-Input Sel.positionen
    DATA: BEGIN OF IT_FILE OCCURS 0,
          IND,
          BUKRS(4),
          GJAHR(4),
          BLART(2),
          BLDAT(10),
          BUDAT(10),
          BKTXT(25),
          HKONT(10),
          BSCHL(2),
          DMBTR(17),
          SGTXT(30),
          ZUONR(17),
          END   OF IT_FILE.
    DATA:    C_NODATA(1)  TYPE C VALUE '/'.   " NODATA
    SELECTION-SCREEN: BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-T01.
    PARAMETERS:       P_LFILE TYPE CHAR70 OBLIGATORY,
                      DS_NAME TYPE CHAR70 OBLIGATORY LOWER CASE,  "< Server file
                      GR_NAME(12) TYPE C DEFAULT 'FI_TEST'.
    SELECTION-SCREEN: END   OF BLOCK BLK1.
    START-OF-SELECTION.
      PERFORM UPLOAD_DATA.
      OPEN DATASET DS_NAME FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
      PERFORM INIT_STRUKTUREN_ERZEUGEN(RFBIBLI0) USING C_NODATA.
      PERFORM SET_DATA.
      CLOSE DATASET DS_NAME.
      PERFORM SUBMIT_RFBIBL00.
    *&      Form  upload_data
    FORM UPLOAD_DATA .
      DATA: L_FILE TYPE RLGRAP-FILENAME.
      L_FILE = P_LFILE.
      CALL FUNCTION 'WS_UPLOAD'
        EXPORTING
          FILENAME                      = L_FILE
          FILETYPE                      = 'DAT'
    *    HAS_FIELD_SEPARATOR           = ','
        TABLES
          DATA_TAB                      = IT_FILE
      IF SY-SUBRC <> 0.
        MESSAGE S398(00) WITH 'Error while uploading'.
        LEAVE LIST-PROCESSING.
      ENDIF.
    ENDFORM.                    " upload_data
    *&      Form  set_data
    FORM SET_DATA .
      PERFORM SET_BGR00.
      LOOP AT IT_FILE.
        CASE IT_FILE-IND.
          WHEN 'H'.
            PERFORM SET_BBKPF.
          WHEN 'D'.
            PERFORM SET_BBSEG.
        ENDCASE.
      ENDLOOP.
    ENDFORM.                    " set_data
    *&      Form  set_BGR00
    FORM SET_BGR00 .
      PERFORM INIT_BGR00(RFBIBLI0) USING BGR00.
      BGR00-MANDT = SY-MANDT.
      BGR00-GROUP = GR_NAME.
      BGR00-USNAM  = SY-UNAME.
      BGR00-NODATA = C_NODATA.
      TRANSFER BGR00 TO DS_NAME.
    ENDFORM.                                                    " set_BGR00
    *&      Form  set_bbkpf
    FORM SET_BBKPF .
      PERFORM INIT_BBKPF(RFBIBLI0) USING BBKPF.
      BBKPF-TCODE     = 'FB01'.
      BBKPF-BLART     = IT_FILE-BLART.
      BBKPF-BUKRS     = IT_FILE-BUKRS.
      BBKPF-BLDAT+0(6) = IT_FILE-BLDAT+0(6).
      BBKPF-BLDAT+6(2) = IT_FILE-BLDAT+8(2).
      BBKPF-BUDAT+0(6) = IT_FILE-BUDAT+0(6).
      BBKPF-BUDAT+6(2) = IT_FILE-BUDAT+8(2).
      TRANSFER BBKPF TO DS_NAME.
    ENDFORM.                    " set_bbkpf
    *&      Form  set_bbseg
    FORM SET_BBSEG .
      PERFORM INIT_BBSEG(RFBIBLI0) USING BBSEG.
      BBSEG-NEWKO = IT_FILE-HKONT.
      BBSEG-NEWBS = IT_FILE-BSCHL.
      BBSEG-WRBTR = IT_FILE-DMBTR.
      BBSEG-SGTXT = IT_FILE-SGTXT.
      TRANSFER BBSEG TO DS_NAME.
    ENDFORM.                    " set_bbseg
    *&      Form  submit_rfbibl00
    FORM SUBMIT_RFBIBL00 .
      SUBMIT RFBIBL00 WITH DS_NAME = DS_NAME
                      WITH CALLMODE = 'B'
                      WITH XLOG = 'X'
                      AND RETURN.
    ENDFORM.                    " submit_rfbibl00
    If you have any problem getting file, send me an e-mail (my id is on my business card) I will send you the file as a attachment
    Regards,
    Naimesh Patel

Maybe you are looking for