Showing posts with label rows. Show all posts
Showing posts with label rows. Show all posts

Friday, October 20, 2017

Call Stored Procedure from Python Script

from __future__ import with_statement
from com.ziclix.python.sql import zxJDBC
from itertools import chain
import sys,os,csv
import re
#import urllib2
import wget

d, u, p, v = "jdbc:oracle:thin:@//host:1521/dbName", "apps", "password", "oracle.jdbc.driver.OracleDriver"
db = zxJDBC.connect(d, u, p, v)
c = db.cursor()
c.execute("BEGIN AppName.ProcName();END;")
c.close()
db.commit()
db.close()


file name would be: file.py

/**

select row and
insert row to table


#--select row from db table;fetch only one row
c.execute("select user_id from fnd_user where user_name='VIJAY'")
   swissUser = c.fetchone()
print swissUser
#--convert int to string --
swissUser = str(int(swissUser[0]))

   print "SWISS USER-->"+str(swissUser[0])

#--insert Row to database table
statement = "insert into APP.TBL_BALANCE_CON(FILE_LINE_NUMBER, ACCOUNTING_DATE, CURRENCY_CODE,) Values  ('1', TO_DATE('15-"+row[0]+"', 'DD-MON-YY'), 'STAT')"
print statement
c.execute(statement)

#fetch all rows in database table
c.execute("select line_number,to_char(accounting_date, 'mm/dd/yyyy') from  APP.TBL_BALANCES_CONVERSION")
       rowsLeftout = c.fetchall()
       lineFailed=lineFailed+" <tr>    <th>Line Number</th><th>Accounting Date</th><th>Period Name</th><th>Segment1</th><th>Segment3</th><th>Entered_Dr</th><th>Entered_Cr</th></tr>"
       for rowL in rowsLeftout:
          
          lineFailed=lineFailed"<tr>    <td>"+str(rowL[0])+"</td><td>"+str(rowL[1])+"</td><td>"+str(rowL[2])+"</td><td>"
       lineFailed=lineFailed+"</table> "
       print lineFailed






**/

Tuesday, June 21, 2016

Iterate over the rows ADF

  
import oracle.jbo.Row; 
//interface


  public String iterateRows(){
    DCIteratorBinding itr = ADFUtils.findIterator("ExampleVO1Iterator");
      Row[] rows = (Row[]) itr.getAllRowsInRange();
      String retval = "false";
      for (int i = 0; i < rows.length; i++) {
         
           
                System.out.println("inside Iterator loop: value of Attribute is ****** "+rows[i].getAttribute("AttributeName"));
                if (rows[i].getAttribute("AttributeName").equals("OUT_LINE")) {
                    retval = "true";
                }
                       
    }
    return retval;

}

Thursday, January 21, 2016

DynamicVO with Dynamic Table ADF

http://www.awasthiashish.com/2014/11/populate-dynamic-table-and-form-using.html
https://technology.amis.nl/2015/12/13/dynamic-table-adf-12c/