Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL-DMO and ORACLE
Hi,
You can use the odbc thin driver to connect the oracle datbase. You can create the oracle objects in oracle and the same objects you can create in java and pass the same java object to oracle functions or procedures.
You have insert program in java for emp object. In oracle create the insert_emp function and pass the java object(same as in oracle object) as a IN parameter to insert the java object values into oracle table.
The Oracle function is :
FUNCTION create_company(
o_company IN company_model, p_company_id OUT thr_company.company_id%TYPE) RETURN NUMBER IS BEGIN INSERT INTO thr_company ( company_id, company_name, company_type, address1, address2, city, state, zip, url1, url2, url3, phone, fax, link_elsewhere, ticker_symbol, company_logo, status, hcd_id, thr_company_id, country, primary_id, secondary_id, primary_label, secondary_label, created_date) VALUES( p_company_id, o_company.company_name, o_company.company_type, o_company.address1, o_company.address2, o_company.city, o_company.state, o_company.zip, o_company.url1, o_company.url2, o_company.url3, o_company.phone, o_company.fax, o_company.link_elsewhere, o_company.ticker_symbol, o_company.company_logo, o_company.status, o_company.hcd_id, o_company.thr_company_id, o_company.country, o_company.primary_id, o_company.secondary_id, o_company.primary_label, o_company.secondary_label, SYSDATE); COMMIT; v_sql_identifier := 'SQL Section 2'; RETURN v_retval; EXCEPTION WHEN OTHERS THEN RAISE_APPLICATION_ERROR(-20001,SQLCODE || SQLERRM); RETURN 1; END;
Thanks,
Mohan Reddy G
schw wrote:
> Hi
>
> is there any equivalent of SQL-DMO for Oracle? I'd like to be able to
> enumerate, create objects like triggers on Oracle using JAVA. Shall I
> just use JDBC thin driver? what are your opinions?
>
> thanks
>
> greets
> schw
Received on Fri Aug 25 2006 - 12:13:05 CDT