How to use bash within sqlplus?

How to use bash within sqlplus?
meaning I am doing something like this to look for files within a particular directory with some condition.
N=0
for i in $(find . -path \*/waiting/* -type f -not -name "SS*" -mmin +120 -print) ; do
testarray[$N]="$i"
echo "$i"
let "N= $N + 1"
done
Output from above script is as follows:
/d1/d2/d3/d4/waiting/abcd.txt
/d1/d2/d31/d42/waiting/pqrs.txt
/d1/d2/d32/d43/waiting/xyz.txt
And now I want to input this data into database with help of insert.
and here is the little pl/sql block to insert the data with looping thing.
sqlplus $CONNECT <<-EOF
DECLARE
Counter integer :=1;
BEGIN
WHILE Counter <= ${no_of_files} LOOP
INSERT INTO stuck_files(COL_DATE,SER_NAME,TYPE_FILE,FILENAME,FILE_STATUS) VALUES (sysdate,'pqrs','pqrs','pqrs','pqrs');
Counter := Counter + 1;
END LOOP;
END;
commit;
exit;
EOF
Mapping is as follows:
COL_DATE,SER_NAME,TYPE_FILE,FILEFILENAME,FILE_STATUS
sysdate,d3,d4,abcd.txt,waiting
sysdate,d31,d42,pqrs.txt,waiting
sysdate,d32,d3,xyz.txt,waiting
any idea how to do that?
Edited by: user9274197 on Apr 28, 2013 5:09 PM

user9274197 wrote:
How to use bash within sqlplus?
meaning I am doing something like this to look for files within a particular directory with some condition.
N=0
for i in $(find . -path \*/waiting/* -type f -not -name "SS*" -mmin +120 -print) ; do
testarray[$N]="$i"
echo "$i"
let "N= $N + 1"
done
Output from above script is as follows:
/d1/d2/d3/d4/waiting/abcd.txt
/d1/d2/d31/d42/waiting/pqrs.txt
/d1/d2/d32/d43/waiting/xyz.txt
And now I want to input this data into database with help of insert.
and here is the little pl/sql block to insert the data with looping thing.
sqlplus $CONNECT <<-EOF
DECLARE
Counter integer :=1;
BEGIN
WHILE Counter <= ${no_of_files} LOOP
INSERT INTO stuck_files(COL_DATE,SER_NAME,TYPE_FILE,FILENAME,FILE_STATUS) VALUES (sysdate,'pqrs','pqrs','pqrs','pqrs');
Counter := Counter + 1;
END LOOP;
END;
commit;
exit;
EOF
Mapping is as follows:
COL_DATE,SER_NAME,TYPE_FILE,FILEFILENAME,FILE_STATUS
sysdate,d3,d4,abcd.txt,waiting
sysdate,d31,d42,pqrs.txt,waiting
sysdate,d32,d3,xyz.txt,waiting
any idea how to do that?
Edited by: user9274197 on Apr 28, 2013 5:09 PMhttp://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:439619916584
Cheers,

Similar Messages

  • How to use List within javaFX(*.fx) script?

    How to use java.util.List within javaFX(*.fx) script?
    The following is my code in Java
    PDBFileReader pdbreader = new PDBFileReader();
              pdbreader.setPath("/Path/To/PDBFiles/");
              pdbreader.setParseSecStruc(true);// parse the secondary structure information from PDB file
              pdbreader.setAlignSeqRes(true);  // align SEQRES and ATOM records
              pdbreader.setAutoFetch(true);    // fetch PDB files from web if they can't be found locally
              try{
                   Structure struc = pdbreader.getStructureById(code);
                   System.out.println("The SEQRES and ATOM information is available via the chains:");
                   int modelnr = 0 ; // also is 0 if structure is an XRAY structure.
                   List<Chain> chains = struc.getChains(modelnr);
                   for (Chain cha:chains){
                        List<Group> agr = cha.getAtomGroups("amino");
                        List<Group> hgr = cha.getAtomGroups("hetatm");
                        List<Group> ngr = cha.getAtomGroups("nucleotide");
                        System.out.print("chain: >"+cha.getName()+"<");
                        System.out.print(" length SEQRES: " +cha.getLengthSeqRes());
                        System.out.print(" length ATOM: " +cha.getAtomLength());
                        System.out.print(" aminos: " +agr.size());
                        System.out.print(" hetatms: "+hgr.size());
                        System.out.println(" nucleotides: "+ngr.size()); 
              } catch (Exception e) {
                   e.printStackTrace();
              }The following is my code in JavaFX(getting errors)
    var loadbtn:SwingButton = SwingButton{
        text:"Load"
        action: function():Void{
            var pdbreader = new PDBFileReader();
            var structure = null;
            try{
                structure = pdbreader.getStructure(filepath.text);
                List<Chain> chains = structure.getChains(0);
                foreach (Chain cha in chains){
                        List < Group > agr = cha.getAtomGroups("amino");
                        List < Group > hgr = cha.getAtomGroups("hetatm");
                        List < Group > ngr = cha.getAtomGroups("nucleotide");
            } catch (e:IOException) {
                e.printStackTrace();
        };I'm using Netbeans 6.5 with JavaFX
    (PDBFileReader, Chain, Structure etc are classes from my own package, already added to the library folder under the project directory)
    Simply put, How to use List and Foreach in JavaFX?

    We can not use Java Generics syntax in JavaFX. But we can use Java Collection classes using the keyword 'as' for type-casting.
    e.g.
    import java.util.LinkedList;
    import java.util.List;
    import javafx.scene.shape.Rectangle;
    var outerlist : List = new LinkedList();
    var innerlist : List = new LinkedList();
    innerlist.add(Rectangle{
        width: 10 height:10});
    innerlist.add(Rectangle{
        width: 20 height:20});
    outerlist.add(innerlist);
    for (inner in outerlist) {
        var list : List = inner as List;
        for (element in list) {
            var rect : Rectangle = element as Rectangle;
            println("(width, height)=({rect.width}, {rect.height})");
    }

  • How to use ShowValue within a UIX/JSP page to display an active link?

    I am storing URL's in the DB and want to display them as active links on a UIX/JSP page. I thought that I had this working some time ago, but now it no longer works.
    Using <bc4juix:RenderValue datasource="ds1" dataitem="myTextField" /> will display "http://www.otn.oracle.com" as an inactive link using UIX/XML which is expected.
    Using <jbo:ShowValue datasource="ds1" dataitem="myTextField" /> will display an active link using if using BC4J/JSP, which is expected.
    However, I have not been able to do this using a UIX/JSP page.
    Is it possible to use ShowValue within a UIX/JSP page to display an active link?
    Thanks,
    Bill G

    Hi Juan,
    I've done the following and it does not work for me;
    --- snip ---
    <uix:form name="form1" method="GET">
    <bc4juix:Table datasource="ds1" >
    <uix:columnHeaderStamp>
    <uix:styledText textBinding="LABEL"/>
    </uix:columnHeaderStamp>
    <%--
    <jbo:AttributeIterate id="dsAttributes" datasource="ds1" hideattributes="UixShowHide">
    <bc4juix:RenderValue datasource="ds1" dataitem="<%=dsAttributes.getName()%>" />
    </jbo:AttributeIterate>
    --%>
    <bc4juix:RenderValue datasource="ds1" dataitem="FacilityDesc" />
    <bc4juix:RenderValue datasource="ds1" dataitem="LocationId" />
    <bc4juix:RenderValue datasource="ds1" dataitem="LocationDesc" />
    <%-- ** THE FOLLOWING DOES NOT DISPLAY ON THE BROWSE_EDIT_PAGE ** --%>
    <jbo:ShowValue datasource="ds1" dataitem="Notes" ></jbo:ShowValue>
    <%-- ** THE FOLLOWING DOES NOT DISPLAY ON THE BROWSE_EDIT_PAGE ** --%>
    <uix:rawText>
    <jbo:ShowValue datasource="ds1" dataitem="Notes" ></jbo:ShowValue>
    </uix:rawText>
    <%-- ** THE FOLLOWING DOES NOT DISPLAY ON THE BROWSE_EDIT_PAGE ** --%>
    <uix:contents>
    <uix:rawText>
    <jbo:ShowValue datasource="ds1" dataitem="Notes" ></jbo:ShowValue>
    </uix:rawText>
    </uix:contents>
    --- snip ---
    Bill G...

  • How to use SelectOneRadio within a DataTable

    Hi,
    I have a requirement to have a radio button for each row in the datatable. It is to enable selecting one row(only one row) from the table and proceed to the next page. The table should look like
    o Name1 address1 city1 state1
    o Name2 address2 city2 state2
    o Name3 address3 city3 state3
    o Name4 address4 city4 state4
    Next>>
    The data structure I have is a collection on objects of type person.
    Class person
    String id;
    String name;
    String address;
    String city;
    String state;
    getters and setters
    I tried to use SelectOneRadio within a Column, but that didnt help. As obvious it treats each rows radio button as a seperate radio group.
    <h:datatable var="person" value="#{personList}>
    <h:column>
    <h:selectOneRadio>
    <f:selectItem itemValue="#{person.id}"/>
    </h:selectOneRadio>
    </h:column>
    <h:column>
    <h:outputText value="#{person.name}"\>
    </h:column>
    </h:datatable>
    I am new to JSF. I searched thru some JSF websites and book, but couldnt find a solution. Can someone help me solve this.
    Thanks in advance
    Rani

    Hi,
    after some time probing into this issue I think none of the many proposed sollutions really solves the underlying problem: Working around the issue becomes much to complicated for JSFs stated design goal of easing development. Certainly for such a common case scenario no workaround should be neccessary, especially given the fact that JSTL is easily able to model this without the need for workarounds!
    In my opinion JSF TagLib implementations should attempt to solve this in a coming version.
    One part of the sollution might be to make <f:selectItem> search it's parent element recursively, i.e. allow the expected container element to be the nearest direct or indirect parent that's suitable. This would allow developers to envelope a <h:dataTable> tag with a <h:selectOneRadio> element. Any <f:selectItem> element inside would therefore be part of a single choice radio button selection, regardless of them being distributed over multiple rows or columns.
    Another part of the sollution might be to allow <h:selectOneRadio> and similar tags to be substitutes for <h:column> tags inside tables. This way a complete column of radio buttons could be used to chose a single value, thereby allowing multiple columns of radio buttons to choose multiple values within the same table.
    Please forward this suggestion for enhancement in kind to the expert group working on the further development of the JSF taglibs. I guess many people besides me already use it as a classical example of complications using JSF during lectures about the tomic, and at least in this case the problem seems completely solvable.
    Kind regards,
    Sascha Baumeister
    software architect, university lecturer and former JCP spec lead JSR086

  • BexAnalyzer 7: How to use SAPBEXSetVariables within VBA?

    Hello,
    I need the function SAPBExsetVariables in Bex 7.0. But this function is empty. Could i use it anyway? And if i could use ist, what is the right code? I just tried it many times, but with no sucsess...
    I have a query with 4 variables one 0calyear and 3 different strings, but how should the range be defined within vba?
    Could you please help me?
    Thank You!
    John
    Edited by: john Thompson on Sep 18, 2008 7:14 AM

    Thunderbird only opens on the default if one profile
    or
    if Profile Manager is instructed to ask at startup it will allow you to choose which Profile to open else it opens on the last Profile used..
    So it shows one Profile at a time in one instance of Thunderbird.
    However, one Profile can have many mail accounts.
    eg: I run 4 mail accounts in one Profile.

  • How to use 'bash' command in java?

    Hi,
    I am using Linux operating system
    when i run the following code, 'test.sh' not started
    ================================================================
    String cmd = "bash \"/home/kulandaivelu/Desktop/works/other's works/test.sh\"";
    Runtime.getRuntime().exec(cmd).waitFor();
    ================================================================
    but it started when i use same command(bash "/home/kulandaivelu/Desktop/works/other's works/test.sh") in terminal
    anyone let me know what mistake i made in the code piece..
    Thanks in Advance
    Kulandaivelu

    Hi,
    thanks a lot..
    I used the following code.. it worked well..
    ===============================================================
    String cmd[] = {"bash","/home/kulandaivelu/Desktop/works other's/test.sh"};
    Runtime.getRuntime().exec(cmd).waitFor();
    ===============================================================
    Thanks a lot again..

  • How to use class within another class?

    Hi,
    I have written a couple of beans, and I have classified them all as part of a "beans" package. All class files are in the same folder. One of the beans in called "ProcessTextBean.class" and it contians a method "validate_email" which validates a supplied email address, I want to call that method from another bean. I think the following line should work but compiler returns an error (Cannot resolve symbol with an arrow underneath "ProcessTextBean"):
    boolean result = beans.ProcessTextBean.validate_email("[email protected]");
    Any ideas what I'm doing wrong? Thanks.
    Junaid.

    beans.ProcessTextBean
    Hihi..
    is you validate_email a static method ?
    if not i dun think you can do it.
    you can try the followingf:
    ProcessTextBean ptb = new ProcessTextBean();
    ............. = ptb.validate_email(emailAdd);
    or
    .................... = new ProcessTextBean().validate_email(emailAdd)
    sorry...i may be wrong.
    its a long time since i touch such a wonderful language such as Java..
    now my org using VBA..:(

  • How to use PERNR in BI7 ?

    I need to ensure that when an employee runs a SAP BI report, that the data returned relates to that employee only.
    In order to do this, I believe I need to utilise PERNR. However, I haven't been able to find any suitable information that tells me what it is or how to use it within SAP BI.
    I also need to create a SAP BI Security Role surrounding this as well. Again, I'm not sure what I need to do or specify.
    Can anyone help?
    Thanks,
    M.

    Hi,
    From the lack of response, I assume no-one has done this before or it's not possible to do.
    Therefore, does anyone have any ideas how I get set up a role that allows the following scenario:
    The organisation has approx 250k employees, all of whom will be set up to use the new SAP HR system that's being created.
    Structural Authorisations are being created within HR, but they only go to manager level and not individual employees.
    There will be some queries which employees will have access to which should allow them to view information about themselves and nobody else.
    How can we restrict the reports or create a security role so they only return information about the user who is running the report?

  • Java mapping how to use com.sap.tc.logging

    Hi I would like to know how to use logging within a java mapping.
    I know i have to use theese classes : Location, Category, ConsoleLog but i dont know how.
    1) How to load the P1, P2, P3 and P4 tags in the Error tag of the SOAP header watched in SXMB_MONI
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
      <SAP:Category>Application</SAP:Category>
      <SAP:Code area="MAPPING">STREAM_TRANSFORMATION_EX</SAP:Code>
      <SAP:P1>SwissMedical/Interfaces/IFI002/LiquidacionMapping~</SAP:P1>
      <SAP:P2 />
      <SAP:P3 />
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>Java mapping of application triggered an exception</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    2) How to load and activate log in the DIAGNOSTIC tag of the SOAP Header.
    - <SAP:Diagnostic xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
      <SAP:TraceLevel>Information</SAP:TraceLevel>
      <SAP:Logging>Off</SAP:Logging>
      </SAP:Diagnostic>
    Thanks!!

    As already suggested, you can display custom messages using AbstractTrace.
    trace = (AbstractTrace)param.get( StreamTransformationConstants.MAPPING_TRACE );
                        trace.addInfo("G1-CYCLE is missing");
    For more on coding front refer:
    http://help.sap.com/javadocs/NW04/current/pi/com/sap/aii/mapping/api/StreamTransformation.html
    To get this trace seen in MONI, set parameter TRACE_LEVEL in SXMB_ADM to 2.

  • How can I connect to the database using ODBC within excel.

    Hi,
    How can I connect to the database using ODBC within excel and just refresh the data when needed.
    Thanks,
    Priyanka
    Edited by: user554934 on Jun 9, 2009 2:53 AM

    This is NOT an APEX relevant question, try posting it in the SQL/PL/SQL Forum..
    Thank you,
    Tony Miller
    Webster, TX

  • How to use java source in Oracle when select by sqlplus.

    How to use java source in Oracle when select by sqlplus.
    I can create java source in Oracle
    import java.util.*;
    import java.sql.*;
    import java.util.Date;
    public class TimeDate
         public static void main(String[] args)
    public String setDate(int i){
    GregorianCalendar calendar = new GregorianCalendar();
    calendar.setTime(new Date((long)i*1000));
    System.out.println("Dateline: "
    + calendar.get(Calendar.HOUR_OF_DAY) + ":"
    + calendar.get(Calendar.MINUTE) + ":"
    + calendar.get(Calendar.SECOND) + "-"
    + calendar.get(Calendar.YEAR) + "/"
    + (calendar.get(Calendar.MONTH) + 1) + "/"
    + calendar.get(Calendar.DATE));
    String n = calendar.get(Calendar.YEAR) + "/" + (calendar.get(Calendar.MONTH) + 1) + "/" + calendar.get(Calendar.DATE);
         System.out.print(n);
         return n;
    I have table name TEST
    ID DATE_IN
    1 942685200
    2 952448400
    When I write jsp I use method setDate in class TimeDate
    The result is
    ID DATE_IN
    1 1999/11/16
    2 2003/7/25
    Thanks you very much.

    It is unclear where you are having a problem.  Is your issue at runtime (when the form runs in the browser) or when working in the Builder on the form?
    Also be aware that you will need to sign your jar and include some new manifest entries.  Refer to the Java 7u51 documentation and blogs that discuss the changes.
    https://blogs.oracle.com/java-platform-group/entry/new_security_requirements_for_rias
    http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/manifest.html

  • Need help on how to use conference facility within adobe connect

    I need some help on how to use conference facility within adobe connect?

    I'd recommend you start here: Getting Started with Adobe Connect - Adobe Connect User Community

  • How to use a Webservice (deployableproxy) within a portal component?

    hi,
    i need to know how to use a webservice using a deployable proxy within a portal component?
    i've created the proxies and they work (with servlets).
    i know how to use them in servletes (context lookup, jndi mapping, application references) but i cant find a way to use them in a portal component.. tried the context lookup way but cant figure out which jndi mapping to use.
    any help?
    thanks in advance,
    constantin

    i've found this document:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/43/cb2e29578c0262e10000000a11466f/frameset.htm
    but it doesn't help...
    i should add a privatesharing resource...
    <property name="PrivateSharingReference" value="SAPJ2EE::rh21.de/pca~wsproxy"/>
    which works
    this is my code
    public void doContent(IPortalComponentRequest request,IPortalComponentResponse response) {
       try {
         Context context = new InitialContext();
         WSPhonebook obj = (WSPhonebook) context.lookup("/wsclients/proxies/rh21.de/pca~wsproxy/de.rh21.wsproxy.phonebook.WSPhonebook");
         WSPhonebookViDocument phonebook = (WSPhonebookViDocument) obj.getLogicalPort("Config1Port_Document", WSPhonebookViDocument.class);
    } catch.....
    now the lookup works (i guess, no messages about that anymore), but i catch ClassNotDefFoundError-Exceptions, but the classes are there, i can strg+click them in the editor, they are in the used dc's etc.
    any help? its quite uurgent :/

  • Sqlplus how to use arrow key look the history

    sqlplus in DOS, I can use arrow to look the sql statement history.
    How to use arrow in Solaris.
    Thanks

    If you were using Linux, I'd refer you to http://www.dizwell.com/prod/node/56
    Since you aren't, I'll refer you to that anyway and hope that you find a way of compiling rlwrap for Solaris.

  • How to use Operating System Commands while using define in sqlplus

    How to use Operating System Commands while using define in sqlplus . The Host OS is Linux
    define report_name=PROD_${host date "+%b"}.html
    The above is not working.
    The output should be 
    define report_name=PROD_JAN.html
    Regards,
    DB

    of course I was talking nonsense: the problem here is the mixing of bind variables and DEFINE variables.
    With the following changes the script should work (the conditions for begin_interval_time are perhaps not what you want):
    variable snap1 number
    variable snap2 number
    variable rptname varchar2(20)
    begin
    SELECT min(snap_id) into :snap1 FROM dba_hist_snapshot WHERE CAST(begin_interval_time AS DATE) >= SYSDATE-1;
    SELECT max(snap_id) into :snap2 FROM dba_hist_snapshot WHERE CAST(begin_interval_time AS DATE) >= SYSDATE-1;
    end;
    col file_name_value new_value report_name noprint
    select 'PROD_'|| to_char(sysdate,'MON') || '_' ||  to_char(sysdate,'DD') file_name_value  from dual;
    define  report_type  = 'html'
    define num_days=2
    define begin_snap=:snap1
    define end_snap=:snap2
    @@?/rdbms/admin/awrrpt.sql

Maybe you are looking for

  • No mail in iPad air inbox

    I have several email accounts but there is just one account where the mail doesn't download into the inbox of my iPad air. The things that throws me is that emails from this same account download to all the other folders (eg sent, trash) except to th

  • Can a PDF be converted to a jpeg?

    see above

  • Deploy Issue with Java Biller Direct Component

    Hello Gurus, I am customizing the .jsp files of the Biller Direct Java component. Then i build them and deploy the .EAR file to server. After that when i open the web page the changes are not reflected.  Can any one let me know how do i build and dep

  • Using PCard, Procurement Card, Purchasing Card

    Client wants to use pcards as part of the procurement process. They are planning on implementing ECC. If we use standard Preq and PO functionality, can we use Pcards? If so, what is the process flow? Are Pcards only an SRM functionality?

  • QM-inspection type

    Dear all i have assign 2 inspection types 05 and 08 for a raw material.now please guide me when lot 'll be triggered by 08 type and when with 05. because i have a con fusion that when we make stock transfer by a movement type then inspection lot 'll