Using dbms_output in Trigger

hi
I asked my question previous;y but couldnt get an exact answer for my question
I have three table grade
grade(studentno,courseno,grade)
courses(courseno,coursename)
prerequisite(courseno,prereqcourseno)
prereq(courseno) is foreign key on courses(courseno)
I want to make I trigger that when one try to add a course in grade table
the trigger will check the prerequisite of that course
and if the course is not exist in grade table( which means student has not take the prereq before)
the trigger will give an error and will report the prerequisites that the student need for that course;
The problem is I cant show the prerequisite courses that the student need, when I insert a course without prerequisite.
for example let say prereq of course C is A and B
so when I try to insert A into grade, the trigger should say that u cant do it, because u nedd A and B
thanks in advance

I agree totally with Kamal Kishores opinion. even i discourage my friends , the usage of DBMS_OUTPUT package.
It should be used more or less as a tool for debugging. As a beginner it may be advantageous and easy to learn abt the
stored procedure programming. But keeping in view that PL/SQL is more used in the backend processing. Just keep in view that
we are using a front end tool and we are writing our programs in back end (PL/SQL) then the use of DBMS_OUTPUT package and
dependency on that is waste of efforts. infact the point of DBMS_OUTPUT using to output a big chunk of varchar2 string to the
client SQL*PLUS window may / may not be advantageous.
coz if we are using Windows client and using the DBMS_OUTPUT put display the message on the screen then we may not be seeing
the messages immediately on the screen unless the execution of the program is completed. For that we are using our debugging in a separate way.
Suppose if i want to know what is the program doing at the current instance of time , then it may not be possible using DBMS_OUTPUT package.
my debugging style is in this way. I have created a procedure with AUTONOMOUS TRANSACTION with a single arguement of VARCHAR2;
CREATE OR REPLACE PROCEDURE SEND_MES(MES VARCHAR2) IS
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
INSERT INTO DEBUG_TRAP VALUES(MES,TO_CHAR(SYSDATE,'HH24-MI-SS'));
COMMIT;
end;
EVEN THOUGH IT MAY BE AN OVER HEAD but it is very very advantageous to findout how the program is behaving and
where the current control is in the program. i monitor the values inputted in the table DEBUG_TRAP using another session. which makes me easily understandable where my program is
and gives me idea how to improve / tune my program .
prakash

Similar Messages

  • Data-acquisition with NI 6036E DAQ card & GPIB using an external trigger

    Hi all,
    I hope somebody could give me some help with the following and answer some questions:
    Simple system description:
    Labview 6.1
    PCI-GPIB card
    6036E DAQ card
    In my system, I am using an external analog trigger signal (A) for continuous data-acquisition. Characteristics of the analog trigger signal (A) are: ~40 Hz, signal height +1.48V, triggered by rising edge (the analog trigger signal (A) could be changed to a TTL signal). Each data-acquisition is done within ~1.0 ms after the rising edge of the trigger pulse. The timing of the data-acquisition and analyzing procedure is controlled by execution in a sequence structure placed in a loop.
    Now, I connected a power meter to the system, to measure the laser power during the data-acquisition. The power meter has two options to provide the laser power data:
    a) via analog signal output (voltage corresponds to laser power in watts)
    b) via GPIB (direct output reading of laser power in watts).
    Problem:
    During a certain point in my data-acquisition sequence structure (defined by a frame), I want to use the next occuring analog trigger signal (A) to acquire 1 value from the power meter.
    How do I do this in Labview programming for the following two situations?
    a) If I connect the analog output from the power meter to an analog input channel of the 6036E DAQ card. The analog trigger (A) would be connected to a second analog input channel (In case the analog trigger signal (A) is changed to a TTL signal it would be connected to the PFI0/Trig input pin on the DAQ card).
    b) If I use the GPIB connection of the power meter. The analog trigger (A) would be connected to a second analog input channel (In case the analog trigger signal (A) is changed to a TTL signal it would be connected to the PFI0/Trig input pin on the DAQ card).
    An other possibility would be to trigger the power meter directly, so it outputs constantly power meter values at ~40 Hz. How could I than acquire 1 power meter value (at a certain time im my sequence structure) via analog input at DAQ card or GPIB?
    Additional questions:
    How do I configure the PFI0/Trig pin on the 6036E DAQ board individually as an INPUT?
    How do I use an analog trigger signal (A) as counting signal for a loop, or as an activation signal for a sequence structure which includes GPIB commands?
    It would be very nice if somebody could give me some help.
    Kind regards,
    beam

    Hi beam,
    I just want to verify that I understand your situation correctly:
    An external trigger signal (A) is wired to one of your input channels (e.g. CH0) to trigger data acquisition of a second channel (e.g. CH1). Your power meter is connected to an analog input channel, which you would like to trigger with a certain rising edge at some of your sequence structure.
    Problem:
    During a certain point in my data-acquisition sequence structure (defined by a frame), I want to use the next occuring analog trigger signal (A) to acquire 1 value from the power meter.
    How do I do this in Labview programming for the following two situations?
    a) If I connect the analog output from the power meter to an analog input channel of the 6036E DAQ card. The analog trigger (A) would be connected to a second analog input channel (In case the analog trigger signal (A) is changed to a TTL signal it would be connected to the PFI0/Trig input pin on the DAQ card).
    If a task has been configured to acquire signal from one analog channel, it's not possible to run a second analog input task or to add a second channel on the fly. You had mentioned that it's possible to read from the instrument through GPIB. Is it possible to perform a software trigger such that at a certain frame of your structure, when the trigger signal A reaches voltage "x", a GPIB command is written to your power meter to query a measurement reading?
    Additional questions:
    How do I configure the PFI0/Trig pin on the 6036E DAQ board individually as an INPUT?
    You do not need to explicitly configure the PFI0 line as an input. If you want to use it as an input such that it acts as an analog trigger, simply wire the trigger signal to this pin. When configuring the trigger in your software, specify PFI0 as the trigger source.
    How do I use an analog trigger signal (A) as counting signal for a loop, or as an activation signal for a sequence structure which includes GPIB commands?
    You can try using the Limit VI to find out when the trigger signal reaches a certain level, and count how many times this level is reached. Similarly, you can use this as the condition to execute GPIB commands.
    Hope this helps,
    Lesley

  • How to print new line using DBMS_OUTPUT package

    Hi,
    I am trying to print a new line using DBMS_OUTPUT package. but it do not print the new line.
    set serveroutput on size 200000
    set feedback on
    BEGIN
    DBMS_OUTPUT.PUT_LINE('First Line');
    DBMS_OUTPUT.PUT_LINE('');
    DBMS_OUTPUT.PUT_LINE('Second Line');
    END;
    I expect following output ...
    First Line
    Second Line
    but i got following output....
    First Line
    Second Line
    why DBMS_OUTPUT.PUT_LINE( '); is not printing a new line ?

    You can try the following:
    SQL> ED
    Wrote file afiedt.buf
      1  BEGIN
      2  DBMS_OUTPUT.PUT('ONE LINE...');
      3  DBMS_OUTPUT.PUT('SECOND LINE...');
      4  DBMS_OUTPUT.NEW_LINE;
      5  DBMS_OUTPUT.PUT_LINE('THIRD LINE WITH NEW LINE...');
      6  DBMS_OUTPUT.PUT('TEST');
      7  DBMS_OUTPUT.NEW_LINE;
      8  DBMS_OUTPUT.PUT_LINE('FOURTH LINE'||CHR(10)||'EXAMPLE');
      9  DBMS_OUTPUT.PUT_LINE(CHR(10));
    10  DBMS_OUTPUT.PUT_LINE('FIFTH LINE');
    11* END;
    SQL> /
    ONE LINE...SECOND LINE...
    THIRD LINE WITH NEW LINE...
    TEST
    FOURTH LINE
    EXAMPLE
    FIFTH LINE
    PL/SQL procedure successfully completed.Documentation:
    http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_output.htm#i1000062

  • With DAQmx, how to use AO start trigger for AO/AI synchronization with finite AI sampling

    I am a new user to DAQmx and I am trying to synchronize AI (finite samples) with AO in LabVIEW 7.1 using a PCI 6229 card. I want to generate a finite waveform (AO) and, subsequently, collect a finite number of voltage samples (AI). I would like to repeat the AO-AI cycles in a while loop.
    Alternatively, I could use an infinite AO generation and collect finite number of voltage samples on AI but always exactly at the same spot of the AO buffer.
    Using traditional DAQ and a 6024E card, I used a counter triggered by AO start trigger signal (example attached). I have problems with translating this example into DAQmx.
    Please help!
    Ruber
    Attachments:
    AIAODelay_traditional_Eseries.vi ‏155 KB

    Lesley,
    Thank you very much for your suggestion. Late last night I actually tried a to use AI start trigger instead of AO start trigger and it worked (since I tried the AI & AO to start simultaneously, it does not matter what triggers what), even in the loop. The devil is in details, as I had to carefully wire the number of data points and what to place inside/outside the loop.
    The problem with shared clock is that I need to sample the AI and AO at different rates but using AO and AI clock separately did not seem to affect the performance.
    I still want to try to use the AO start trigger (as you suggest) because I would like to delay the AI by a few ms from the AO. Is there a simple way to to that?
    I suppose, switching from traditional DAQ to DAQmx requires your brain to be rewired - after playing with it for a couple of days and nights I developed a "feeling" for it. One of the differences was that, in order to use this example in the loop, one has to use 'stop task' inside and 'clear task' outside the loop.
    Thanks again!
    Radek Uberna

  • Error while using Before report trigger. -- Urgent

    Dear All,
    The following error I am getting when I execute my data template where I have used Before Report Trigger. I am also pasting the Data Template that I have developed.
    ============================
    Error
    ============================
    XDO Data Engine Version No: 5.6.3
    Resp: 20560
    Org ID : 204
    Request ID: 4846248
    All Parameters: P_LOB=01:P_DIV_FROM=:P_DIV_TO=:P_FROM_ORG=:P_TO_ORG=:P_INV_FROM=:P_TO_INV=:P_TRX_DATE_FROM="2003/01/01 00:00:00":P_TRX_DATE_TO="2003/01/15 00:00:00"
    Data Template Code: SSBWIPANA_MFGR
    Data Template Application Short Name: WIP
    Debug Flag: N
    {P_DIV_FROM=, P_TRX_DATE_TO=2003/01/15 00:00:00, P_DIV_TO=, P_FROM_ORG=, P_TO_ORG=, P_TRX_DATE_FROM=2003/01/01 00:00:00, P_INV_FROM=, P_LOB=01, P_TO_INV=}
    Calling XDO Data Engine...
    [122407_011745100][][EXCEPTION] SQLException encounter while executing data trigger....
    java.sql.SQLException: ORA-06550: line 2, column 12:
    PLS-00302: component 'P_LOB' must be declared
    ORA-06550: line 2, column 1:
    PL/SQL: Statement ignored
    ORA-06550: line 3, column 12:
    PLS-00302: component 'P_DIV_FROM' must be declared
    ORA-06550: line 3, column 1:
    PL/SQL: Statement ignored
    ORA-06550: line 4, column 12:
    PLS-00302: component 'P_DIV_TO' must be declared
    ORA-06550: line 4, column 1:
    PL/SQL: Statement ignored
    ORA-06550: line 5, column 12:
    PLS-00302: component 'P_FROM_ORG' must be declared
    ORA-06550: line 5, column 1:
    PL/SQL: Statement ignored
    ORA-06550: line 6, column 12:
    PLS-00302: component 'P_TO_ORG' must be declared
    ORA-06550: line 6, column 1:
    PL/SQL: Statement ignored
    ORA-06550: line 7, column 12:
    PLS-00302: component 'P_FROM_INV' must be declared
    ORA-06550: line 7, column 1:
    PL/SQL: Statement ignored
    ORA-06550: line 8, column 12:
    PLS-00302: component 'P_TO_INV' must be declared
    ORA-06550: line 8, column 1:
    PL/SQL: Statement ignored
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
         at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:215)
         at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:967)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1168)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3327)
         at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3433)
         at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4394)
         at oracle.apps.xdo.dataengine.XMLPGEN.executeTriggers(XMLPGEN.java:699)
         at oracle.apps.xdo.dataengine.XMLPGEN.processData(XMLPGEN.java:254)
         at oracle.apps.xdo.dataengine.XMLPGEN.processXML(XMLPGEN.java:205)
         at oracle.apps.xdo.dataengine.XMLPGEN.writeXML(XMLPGEN.java:237)
         at oracle.apps.xdo.dataengine.DataProcessor.processData(DataProcessor.java:364)
         at oracle.apps.xdo.oa.util.DataTemplate.processData(DataTemplate.java:236)
         at oracle.apps.xdo.oa.cp.JCP4XDODataEngine.runProgram(JCP4XDODataEngine.java:293)
         at oracle.apps.fnd.cp.request.Run.main(Run.java:157)
    =====================================================
    Data Template
    ====================================================
    <dataTemplate name="SSBWIPANA_MFGR" defaultPackage="PRODUCTION" version="1.0">
    <parameters>
    <parameter name="P_LOB" datatype="charecter"/>
    <parameter name="P_DIV_FROM" datatype="charecter"/>
    <parameter name="P_DIV_TO" datatype="charecter"/>
    <parameter name="P_FROM_ORG" datatype="charecter"/>
    <parameter name="P_TO_ORG" datatype="charecter"/>
    <parameter name="P_FROM_INV" datatype="charecter"/>
    <parameter name="P_TO_INV" datatype="charecter"/>
    <parameter name="P_TRX_DATE_FROM" datatype="charecter"/>
    <parameter name="P_TRX_DATE_TO" datatype="charecter"/>
    </parameters>
    <dataQuery>
    <sqlStatement name="Q_1">
    <![CDATA[SELECT DISTINCT MSI.CONCATENATED_SEGMENTS, MMT.INVENTORY_ITEM_ID,
                    MSI.DESCRIPTION, MMT.TRANSACTION_UOM, SDT.TRX_DATE,
                    MTP.ORGANIZATION_CODE, MMT.ORGANIZATION_ID
               FROM MTL_MATERIAL_TRANSACTIONS MMT,
                    MTL_PARAMETERS MTP,
                    MTL_SYSTEM_ITEMS_VL MSI,
                    SSBWIP_DATE_TEMP SDT
              WHERE MMT.INVENTORY_ITEM_ID = MSI.INVENTORY_ITEM_ID
                AND MMT.ORGANIZATION_ID = MSI.ORGANIZATION_ID
                AND MSI.ORGANIZATION_ID = MTP.ORGANIZATION_ID
                AND MMT.ORGANIZATION_ID = MTP.ORGANIZATION_ID
                AND MMT.TRANSACTION_TYPE_ID IN (17, 44)
                AND MMT.ORGANIZATION_ID IN (
                       SELECT MP.ORGANIZATION_ID
                         FROM MTL_PARAMETERS MP, GL_CODE_COMBINATIONS GCC
                        WHERE MP.MATERIAL_ACCOUNT = GCC.CODE_COMBINATION_ID
                          AND GCC.SEGMENT1 = :P_LOB
                          AND (GCC.SEGMENT2 BETWEEN NVL (:P_DIV_FROM,
                                                         GCC.SEGMENT2)
                                                AND NVL (:P_DIV_TO, GCC.SEGMENT2)
                AND MTP.ORGANIZATION_CODE BETWEEN NVL (:P_FROM_ORG,
                                                       MTP.ORGANIZATION_CODE
                                              AND NVL (:P_TO_ORG,
                                                       MTP.ORGANIZATION_CODE
                AND MSI.CONCATENATED_SEGMENTS BETWEEN NVL
                                                        (:P_FROM_INV,
                                                         MSI.CONCATENATED_SEGMENTS
                                                  AND NVL
                                                        (:P_TO_INV,
                                                         MSI.CONCATENATED_SEGMENTS
           ORDER BY MSI.CONCATENATED_SEGMENTS, MTP.ORGANIZATION_CODE]]>
    </sqlStatement>
    <sqlStatement name="Q_2">
    <![CDATA[SELECT NVL (SUM (TRANSACTION_QUANTITY), 0) COMPLETION
           FROM MTL_MATERIAL_TRANSACTIONS
         WHERE INVENTORY_ITEM_ID = :INVENTORY_ITEM_ID
           AND ORGANIZATION_ID = :ORGANIZATION_ID
           AND TRANSACTION_TYPE_ID = 44
           AND TRUNC (TRANSACTION_DATE) = :TRX_DATE]]>
    </sqlStatement>
    <sqlStatement name="Q_3">
    <![CDATA[SELECT NVL (SUM (TRANSACTION_QUANTITY) * -1, 0) INCOMPLETION
          FROM MTL_MATERIAL_TRANSACTIONS
        WHERE INVENTORY_ITEM_ID = :INVENTORY_ITEM_ID
          AND ORGANIZATION_ID = :ORGANIZATION_ID
          AND TRANSACTION_TYPE_ID = 17
          AND TRUNC (TRANSACTION_DATE) = :TRX_DATE]]>
    </sqlStatement>
    <sqlStatement name="Q_4">
    <![CDATA[SELECT DESCRIPTION
          FROM FND_FLEX_VALUES_VL
        WHERE FLEX_VALUE_SET_ID = 1002470
              AND FLEX_VALUE = :P_LOB]]>
    </sqlStatement>
    <sqlStatement name="Q_5">
    <![CDATA[SELECT DESCRIPTION
         FROM FND_FLEX_VALUES_VL
        WHERE FLEX_VALUE_SET_ID = 1012471
          AND FLEX_VALUE = :P_DIV_FROM
          AND PARENT_FLEX_VALUE_LOW = :P_LOB]]>
    </sqlStatement>
    <sqlStatement name="Q_6">
    <![CDATA[SELECT DESCRIPTION
         FROM FND_FLEX_VALUES_VL
        WHERE FLEX_VALUE_SET_ID = 1012471
          AND FLEX_VALUE = :P_DIV_TO
          AND PARENT_FLEX_VALUE_LOW = :P_LOB]]>
    </sqlStatement>
    </dataQuery>
    <dataTrigger name="beforeReport" source="PRODUCTION.beforereporttrigger(:P_TRX_DATE_FROM,:P_TRX_DATE_TO)"/>
    <dataStructure>
    <group name="G_CONCATENATED_SEGMENTS" source="Q_1">
    <element name="CONCATENATED_SEGMENTS" datatype="charecter" value="CONCATENATED_SEGMENTS"/>
    <element name="DESCRIPTION" datatype="charecter" value="DESCRIPTION"/>
    <element name="TRANSACTION_UOM" datatype="charecter" value="TRANSACTION_UOM"/>
    <element name="INVENTORY_ITEM_ID" datatype="number" value="INVENTORY_ITEM_ID"/>
    <element name="ORGNIZATION_ID" datatype="number" value="ORGANIZATION_ID"/>
    <group name="G_TRX_DATE" source="Q_1">
    <element name="TRX_DATE" datatype="date" value="TRX_DATE"/>
    <group name="G_1" source="Q_1">
    <element name="ORGANIZATION_CODE" datatype="charecter" value="ORGANIZATION_CODE"/>
    <group name="G_ORGANIZATION_CODEC" source="Q_2">
    <element name="COMPLETION" datatype="number" value="COMPLETION"/>
    </group>
    <group name="G_ORGANIZATION_CODEI" source="Q_3">
    <element name="INCOMPLETION" datatype="number" value="INCOMPLETION"/>
    </group>
    </group>
    </group>
    </group>
    <group name="G_LOB" source="Q_4">
    <element name="CF_LOB" datatype="charecter" value="description"/>
    </group>
    <group name="G_FROM_DIV" source="Q_5">
    <element name="CF_DIVFROM" datatype="charecter" value="description"/>
    </group>
    <group name="G_TO_DIV" source="Q_6">
    <element name="CF_DIVTO" datatype="charecter" value="descrption"/>
    </group>
    <element name="CS_COUNT" function="count()" datatype="number" value="G_CONCATENATED_SEGMENTS.CONCATENATED_SEGMENTS"/>
    </dataStructure>
    </dataTemplate>
    Pls. suggest me.
    null

    Hi,
    without checked the whole document .... you've defined all paramaters as datataype charecter instead of character.
    Regards
    Rainer

  • Printing messages in Log File and Output File using Dbms_output.put_line

    Hi,
    I have a requirement of printing messages in log file and output file using dbms_output.put_line instead of fnd_file.put_line API.
    Please let me know how can I achieve this.
    I tried using a function to print messages and calling that function in my main package where ever there is fnd_file.put_line. But this approach is not required by the business.
    So let me know how I can achieve this functionality.
    Regards
    Sandy

    What is the requirement that doesn't allow you using fnd_file.put_line?
    Please see the following links.
    https://forums.oracle.com/forums/search.jspa?threadID=&q=Dbms_output.put_line+AND+Log+AND+messages&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    https://forums.oracle.com/forums/search.jspa?threadID=&q=%22dbms_output.put_line+%22+AND+concurrent&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks,
    Hussein

  • Using dbms_output .put( substr( blobfield, 1, 20))

    Hello,
    is it possible to print out part of a blob-field using dbms_output.put() or dbms_output.putline() ?
    I just want to visualize that it is filled with informations.
    Thanks for help,
    Dirk
    null

    Hi
    To manipulate a blob, use dbms_lob package.
    You cannot do a substr of BLOB.
    HTH
    Arvind Balaraman

  • How to use 2 Time trigger UI elements

    Hi Experts,
      My user doesn't want to see the time out error in the webdynpro application after leaving(idle mode) the browser for hours. And one more thing is he wants a popup for every 15mnts to show a message on the screen.
    So, I have used 2 Time Trigger UI elements to achieve this functionality,
          1st one(Time Trigger UI Element) is used to show the pop up message and It is working fine to show the message in a Pop Up .
          2nd one is used to handle the Time Out Error for hours and this is not working as expected, if user leaves the browser for hours .
    I hope you understand my requirement and issue.
    Could you please suggest me how to achieve this functionality.
    1000 Thanks in advance.
    Regards,
    Giri

    Hi,
    If I set the 3 hours to 2nd Time Trigger UI element and tested after 2 hours and browser is still throwing the time out error message.
    After 2hrs is the time out error throwing by the Timed trigger or the standard session time out? I believe after 2 hrs the standard session time out is throwing! You need to give the delay time less than your session time out.
    You can get the session timeout using wdr_task=>server->session_timeout ( in mins ) And you can get the application server time out using
    data: name type pfeparname,
            value type pfepvalue.
      name = 'rdisp/plugin_auto_logout'.   " parameter
      call 'C_SAPGPARAM' id 'NAME'  field name
                                        id 'VALUE' field value.   " value contains time out 
    Regards,
    Kiran

  • Printing blank spaces using dbms_output.put_line

    There is one string getting generated dynamically. Upon generation, it may or may not contain blank spaces in the beginning. Then I am trying to print this on standard I/O using DBMS_OUTPUT.PUT_LINE. But if there are some leading spaces in the string, they are ignored. Is there any other way to print the exact string as it is?

    hi..
    it's depend on your client configuration.. you can configure the wrap option at the serveroutput parameter...
    set serveroutput on size 100000 for wrap;
    begin
      2    dbms_output.put_line('  Hello world.');
      3  end;
      4  /
      Hello world.
    PL/SQL procedure successfully completed.

  • Is it possible to start a PCI4472 and a PCI-MIO-16E-1 simultaneously using an analog trigger (with pre-trigger)?

    I would like to start several PCI 4472 and a PCI-MIO-16E-1 simultaneously. All boards are connected via a RTSI cable.
    My program works fine if I use software trigger, or an analog trigger from a PCI4472 channel. However, the analog trigger works only when I set pre-trigger (or pre-scan) to 0.
    Is it possible to start a PCI4472 and a PCI-MIO-16E-1 simultaneously using an analog trigger (with pre-trigger)?
    Thanks.
    Ian Ren

    Hi, Bill
    I think it is possible to set more than 38 pre-trigger scans on a single 4472 card. I've done this before. You can verify this by running the Labview example "Acquire N - Multi-Analog Hardware Trig.vi" which comes with LabView.
    What I try to do but without success/luck so far is to start data acquisitions of several 4472 cards and a PCI-MIO-16E-1 card using an anlog trigger (with pre-trigger).
    Thanks for your help.
    Ian

  • Why we cant use commit in trigger, can any one give proper explanation

    Why we cant use commit in trigger, can any one give proper explanation

    You shouldn't use a commit in a trigger if it's part of the same transaction as the action happening on the table.
    Eg. Suppose you have a table that stores details of orders, and it has a trigger that updates the stock table.
    If a customer comes along and creates an order but decides part way through that actually, they don't want the order after all, the transaction is rolled back.
    If you don't put a commit in the transaction, then the stock table details remain unchanged - no order, so no stock reduction. If, however, you forced the commit to happen in the trigger, you now have no order, but the stock table details have changed.
    That's not what you want to happen!
    Sometimes it does make sense to have a commit in the trigger, but this is very much the exception. If you come across a table mutating error, it usually means that you have a problem with your design and that you need to rethink it, NOT bodge it by using autonomous_transaction and a commit.
    Of course, the times when you'd use triggers should be few and far between - the above example is NOT how I'd code an orders-stock transaction; I'd have some PL/SQL that handled the transaction, rather than direct inserts onto the table.

  • Multiple recording of waveforms using an external trigger signal

    Dear all,
    Maybe somebody could help me with the following:
    System:
    Windows 2000,Pentium III,~800-900MHz,32-bit master PCI bus,256 MB RAM
    PCI-NI 5122 Digitizer
    PCI-GPIB card
    PCI-DAQ card
    Labview 7.1
    NI Scope 2.7
    Problem:
    I want to acquire multiple waveforms (e.g. 100) using an external TTL trigger signal of ~40Hz. I have to acquire 1 waveform per trigger signal i.e. 100 subsequent trigger signals will acquire 100 subsequent waveforms.
    After, or during the waveform acquisition (?), I have to transfer the waveforms as 100 1D-arrays from the onboard memory of the digitizer through my fitting routine (one-by-one!). The fitting routine accepts one waveform (1D-array) at the time, fits the waveform and calculates 1 fit-value per waveform. So, when I pass the acquired 100 waveforms subsequently through the fitting routine, I need to get out a 1D-array with 100 fit-values. This 1D-array with the 100 fit values will be further processed and a final value will be saved.
    This procedure will repeat itself at different points in a sequence structure. The sequence structure will be located in a loop and running for several hours!
    Please see attached program flow diagram.
    Qustions:
    1. When I want to acquire 100 waveforms using 100 subsequent trigger pulses, the attached VI (Multiple_record VI) gives me the following error message:
    ERROR
    "Possible reason(s):
    Driver Status: (Hex 0xBFFA4009)
    A previous acquisition is still in progress. If you are attempting to change an attribute, note you can only change fetch attributes while an acquisition is still in progress.
    Status Code: -1074118647
    What am I doing wrong? Is there a better and more efficient way to do this?
    2. How can I transfer the 100 waveforms from the digitizer, one-by-one as 1D-arrays, through my fitting routine? A waveform will have ~2000-3000 data pts. (DBL type). Remember: I DO NOT HAVE TO SAVE THE WAVEFORMS!
    3. Which way is faster, and more efficient (memory) for my PC system to transfer the waveforms from the onboard memory of the digitizer to the fitting routine?:
    a) Start transfer of already acquired waveforms (1D-arrays), one-by-one through the fitting routine, during the waveform acquisition process is still in progress?
    b) First, acquire the 100 waveforms (1D-arrays), store them in the onboard memory (digitizer) and then transfer them one-by-one through the fitting routine?
    4. How can I make sure that after the waveforms were transferred through the fitting routine, the onboard memory of the digitizer is EMPTY (clear waveforms which have already been fetched) and ready to repeat the waveform acquisition at a different point of the sequence structure?
    5. I do not want to display each acquired waveform because I think it will slow down the acquisition process. Instead, I want to display the last of the acquired 100 waveforms, so I can check my fit and maybe adjust the fit-parameters. How can I do that?
    I think the important thing is to perform this process in the fastest way possible with the best use of the PC resources (memory etc.) because this process will run for hours. Any suggestions?
    It would be very nice if somebody could give me some help with this.
    Kind regards,
    beam
    Attachments:
    program flow diagram.vi ‏11 KB

    The method you use to analyze your data is fine. The only thing I would watch out for is memory problems. If you keep with the numbers you gave earlier, 100 waveforms at 3000 pts/wfm, you will be transferring 2.4MBytes of data per set. This is way over the 1MByte buffer NI-SCOPE uses for data transfer. It will work, but it might be slow. If you have problems, switch to niScope Fetch WDT.vi for your acquisition and move it inside the loop. Before you call the fetch VI, set the record it will fetch by using the property node and setting Fetch->Fetch Record Number using your loop index.
    A couple of other performance tips I think you probably know. The graph inside the loop will slow you down a lot. In addition, the graph of all the data outside the loop will also take a fair amount of time (plotting 2.4MBytes of data). If you want to see just the last waveform, pop-up on the terminal going out of the loop and disable indexing so only the last waveform goes through, not all of them.
    Your analysis method should work fine. You may consider doing an I16 fetch instead of the WDT fetch you are currently using. This will reduce your memory usage by a factor of four, provided you don't immediately convert it to a double array. If your analysis is actually finding a max/min, this is faster on an integer array than a double. You can scale the integers using the numbers in the information cluster. It is much faster to scale one integer at the end than a whole array. That said, the I16 fetch is not particularly faster than the WDT fetch, just less memory. This choice will depend on your analysis.
    The min record length is the minimum number of points the device will acquire. The actual record length is different if the acquisition rate you ask for is not one of the acquisition rates the device is capable of. The acquisition rate is then coerced to the next highest rate and the record length increased so your acquisition time remains constant. This behavior is part of the IVI specification for digitizers. Using your VI as an example, you ask for 300kS/s acquisition rate and 800 data points. What you actually get is 300,300.3003 S/s and 801 data points. The sample rate is determined by an integer divisor from 100MHz, in this case 100,000,000/333. So, if you really want a certain number of data points, you need to set the sample rate to a physically realizeable one. Alternately, you can just fetch the number you want instead of all the points, realizing your sample window will be a bit shorter than you asked for.
    You are correct. To see anything in the records done, you need to delay. However, in this code, the records done output is really not doing anything. The fetch won't fetch until everything is done, so you know all is finished when your data shows up. I would just delete it. If you do want to put a delay in, wrap a sequence structure around the records done query. Add a frame before the current frame and drop a Wait (ms)delay into it. You can find this primitive in the timing and dialog palette. This is an example of when the sequence is actually useful. The delay VI has no good way of enforcing data flow, so the sequence does it.
    The way you have implemented it, you don't need to poll acquisition status. To get acquisition status, use niScope Acquisition Status.vi. You would put this in a WHILE loop before your acquire and exit the WHILE loop when the acquisition was done (or an error occurred) to proceed to the acquisition. Make sure you also put an appropriate delay in the WHILE loop or it will eat your entire processor capacity. The delay should be based on how long you expect the acquisition to take.
    You should definitely put your fetch code in a subVI if you are going to call it more than once. LabVIEW makes it easy. Select the code you need to make into a subVI, then select Edit->Create SubVI. Don't forget to put an icon and documentation in the subVI. You will thank yourself later.
    Let me know if you have any more questions...
    This account is no longer active. Contact ShadesOfGray for current posts and information.

  • Can we use dbms_output.put_line package with forall statement

    Hello Everybody
    Can we use dbms_output.put_line package with forall or can we use insert,update and delete only
    declare
    type emp_rec is table of emp%rowtype
    index by binary_integer;
    t emp_rec;
    begin
    select * bulk collect into t from emp;
    forall i in t.first..t.last
    dbms_output.put_line(t(i).name);
    end;Thanks & Regards
    peeyush
    Edited by: Peeyush on Nov 25, 2010 11:45 PM

    MichaelS wrote:
    Well as the docs explain (though not very clear and detailed, I admit) you can use a dynamic sql statement (execute immediate) with FORALL.You got me interested in the performance side doing this Michael - running PL/SQL code via a FORALL loop.
    It is faster than using a normal FOR loop to execute dynamic PL/SQL - a bit surprising as I expected another context switch to be in there. But seems like the PL/SQL engine is a more clever at optimisation than what I originally credited it with.. ;-)
    Of course - pre-compiled/static PL/SQL code in a FOR loop is the fastest, as expected.
    SQL> declare
      2          type TNumbers is table of number;
      3 
      4          type TTimes is record(
      5                  for_all number,
      6                  for_dynamic number,
      7                  for_static number
      8          );
      9 
    10          type TTimesTable is table of TTimes;
    11 
    12          MAX_ITERATIONS  constant number := 10;
    13 
    14          plBlock         varchar2(1000) :=
    15          'declare i number;
    16          begin i:= :var / 10; end;';
    17 
    18          performance     TTimesTable;
    19          t1              number;
    20          bindVar         TNumbers;
    21          n               number;
    22  begin
    23          select
    24                  level bulk collect into bindVar
    25          from    dual
    26          connect by level <= 10000;
    27 
    28          dbms_output.put_line( 'Iterations: '||bindVar.Count||' for loop cycle(s)' );
    29 
    30          performance := new TTimesTable();
    31          performance.Extend( MAX_ITERATIONS );
    32 
    33          for j in 1..MAX_ITERATIONS
    34          loop
    35                  t1 := dbms_utility.get_time;
    36                  forall i in 1..bindVar.Count
    37                          execute immediate plBlock using bindVar(i);
    38                  performance(j).for_all := dbms_utility.get_time-t1;
    39 
    40                  t1 := dbms_utility.get_time;
    41                  for i in 1..bindVar.Count
    42                  loop
    43                          execute immediate plBlock using bindVar(i);
    44                  end loop;
    45                  performance(j).for_dynamic := dbms_utility.get_time-t1;
    46 
    47                  t1 := dbms_utility.get_time;
    48                  for i in 1..bindVar.Count
    49                  loop
    50                          n := bindVar(i) / 10;
    51                  end loop;
    52                  performance(j).for_static := dbms_utility.get_time-t1;
    53          end loop;
    54 
    55          dbms_output.put_line( 'Times in 100th of a second' );
    56          dbms_output.put_line( rpad('for all',15) || rpad('for dynamic',15) || rpad('for static',15) );
    57          for i in 1..performance.Count
    58          loop
    59                  dbms_output.put_line(
    60                          rpad( performance(i).for_all, 15 )||' '||
    61                          rpad( performance(i).for_dynamic, 15 )||' '||
    62                          rpad( performance(i).for_static, 15)
    63                  );
    64          end loop;
    65 
    66  end;
    67  /
    Iterations: 10000 for loop cycle(s)
    Times in 100th of a second
    for all        for dynamic    for static
    10              72              0
    6               37              0
    6               37              0
    6               37              0
    6               36              0
    6               37              1
    5               37              0
    5               37              0
    6               37              1
    5               37              0
    PL/SQL procedure successfully completed.
    SQL>

  • Problem while using Before insert Trigger

    Hello everybody,
    I am using 9.2.0.4.0 XMLDB..
    The problem occurs while using the before insert trigger shown below to convert a CLOB(:new.file_clob) to XMLTYPE(:new.file_xml). The trigger is on a table with file_clob and file_xml as columns. file_xml column is based on a registered schema.
    The trigger is:
    Create or replace trigger po_2_demo_xml_tab_trg
    before insert on po_2_demo_xml_tab
    FOR EACH ROW
    -- Step 1:to convert CLOB to XMLtype and store it
    --in :new.file_xml .
    :new.file_xml := xmltype(:new.file_clob);
    -- Step 2:to verify if :new.file_xml has been created
    dbms_output.put_line(:new.file_xml.extract('/PurchaseOrder/PONum/text()').getStringVal());
    end;
    If u insert a valid xml file, u can see the PONum value on dbms output(Step 2 of the trigger works). u also get the "1 row inserted" message.
    Surpisingly, if u query on the table it shows that the file_xml column is null! For some reason, the value of :new.file_xml in the before insert trigger is not being retained in the table.
    Has anybody encountered this before? Do I have to apply any patch?
    Appreciate any help in this regard.
    Thanks,
    Partha.

    sorry! I just noticed.. the trace file does show an error, but the error is while creating the table itself.
    Please see the segment from trace file below:
    The following statements encountered a error during parse:
    create table po_2_demo_clob_xml_tab
    file_clob CLOB,
    file_xml xmltype
    )xmltype column file_xml
    XMLSCHEMA "http://Friday/PO_2.xsd"
    ELEMENT "PurchaseOrder";
    XCTEND rlbk=0,
    Error encountered: ORA-00911
    But, inspite of this I am able to insert a xml file into file_xml using a sql statement. But the before insert trigger does not retain :new values.
    Appreciate any comments.
    Thanks,
    Partha.

  • How can I retrieve the condition in an update or delete using instead of trigger

    I have 2 tables, on which a view is created. To distinguish the tables within the view trigger, a column "source" had been added in the view creation. I want to be able to delete row(s) in table t1 or table t2 through the view, depending on a condition. The problem is that I don't know how I can get back the delete condition IN the INSTEAD of trigger :
    CREATE TABLE t1(m NUMBER, n VARCHAR2(10), o date);
    CREATE TABLE t2(a NUMBER, b VARCHAR2(10), c date);
    -- The view is created based on the 2 tables.
    CREATE OR REPLACE VIEW vt12 AS
    SELECT 't1' source, m, n, o
    FROM t1
    UNION
    SELECT 't2' source, a, b, c
    FROM t2;
    -- The trigger will fire whenever INSERT is performed on the tables through the view
    create or replace trigger tvt12 instead of insert or delete on vt12
    begin
    if inserting then
    if :new.source = 't1' then
    insert into t1 values (:new.m, :new.n, :new.o);
    else
    -- will insert a default value of -1 for the fourth column "d"
    insert into t2(a,b,c,d) values (:new.m, :new.n, :new.o, -1);
    end if;
    elsif deleting then
    -- We don't know the condition for the deletion, so all rows from the
    -- table from which the current row is coming will be deleted
    if :old.source = 't1' then
    delete t1;
    else
    delete t2;
    end if;
    end if;
    end;
    show error
    insert into vt12 values ('t1',1,'1',sysdate);
    insert into vt12 values ('t2',2,'2',sysdate+1);
    insert into vt12 values ('t1',3,'3',sysdate+2);
    insert into vt12 values ('t2',4,'4',sysdate+3);
    insert into vt12 values ('t1',5,'5',sysdate+4);
    insert into vt12 values ('t2',6,'6',sysdate+5);
    commit;
    select * from vt12;
    select * from t1;
    select * from t2;
    delete vt12 where m = 1;
    commit;
    select * from vt12;
    select * from t1;
    select * from t2;
    When I execute this script, the delete statement seems to recognize that the condition is affecting a row in table t1, and therefore deletes all rows from the table, as specified in the delete statement of the trigger... But, what I want to do is ONLY to delete the row affected by the original condition. So my question is to know how I can get back the original condition for the delete, and still use it in the trigger, that will be executed INSTEAD of the delete statement.. I checked in the doc, and everywhere an example of INSTEAD OF trigger can be found, but it's always and only using an INSTEAD OF INSERT trigger, which doesn't need a condition.
    Can anyone help ?
    null

    I've never faced this case myself, but from the documentation it would seem that the INSTEAD OF DELETE is also a FOR EACH ROW trigger. Therefore, you don't really have to worry about the actual "where" clause of the original "delete" operation: Oracle has it all parsed for you, so you just need to redirect, in turn, each view record being deleted to the appropriate table.
    In extenso: for your
    delete vt12 where m = 1;
    => the INSTEAD OF trigger fires once for all records in vt12 where m=1, and I would guess that you trigger code should look like:
    begin
    delete from t1 where m = :old.m and n = :old.n and o = :old.o;
    delete from t2 where a = :old.m and b = :old.n and c = :old.o;
    end;
    It's a bit of overkill compared to the "where" clause of the original "delete" statement, but it should do the job...
    BTW, if by any luck you do have some primary key on tables t1 and t2 (say: columns o and c respectively), then obviously you can make the thing simpler:
    begin
    delete from t1 where o = :old.o;
    delete from t2 where c = :old.o;
    end;
    HTH - Didier

Maybe you are looking for

  • MUTLI_ROW_INSERT

    To all, I have a need to create a form/report that has the capability for inserting numerous records into a table. The report is a multi-table join based on certain criteria and that data needs to be inserted into another table based on the user's se

  • Screen painter dropdown list

    hi experts, I have to design one dropdown field, when user click on it, my default value shud be there from 1, 2 & 3. This field is not linked with any database table. Where i have to specify 1,2 & 3. Thanks in advance.

  • Adding Application Server

    I couldn't find any resources on Google.... so please advise if possible :) Given a farm with only one application server, I know that if that server goes down, Central Administration is not accessible. If I wanted to make that tier safer, would it b

  • When will HIGH SPEED internet be available in So. California (Inland Empire)?

    Both Verizon and Time Warner offer speeds of 75, 100, 150 and 300.....Yet we on AT&T are capped at 45.....if you are trying to stream a 3-D movie or program, then the constant buffering must affect you the same way it does me....I usually end up givi

  • [usb_modeswitch] Problem connecting my Huawei E173

    Hello Everyone, I bought an Huawei E173 3G usb pen to use with my netbook when I'm not at home but I've found some problems with the connection of this one with Arch Linux. The only way for the E173 to work properly is to put it in the computer and t