How to insert a number using ADO or OLEDB by oracle provider
I create a talbe .
Create Table A
(id number(7));
I use ADO to access the table a;
_ConnectionPtr pConn=NULL;
pConn.CreateInstance(__uuidof(Connection));
_RecordsetPtr pRst=NULL;
pRst.CreateInstance(__uuidof(Recordset));
pConn->Provider="OraOLEDB.Oracle.1";
try
pConn->Open("","ISVISION","ISVISION",NULL);
pRst->CursorLocation=adUseClient;
pRst->Open("A",pConn.GetInterfacePtr(),adOpenStatic,adLockOptimistic,adCmdTable);
pRst->AddNew();
pRst->Fields->Item[0L]->Value=100L;
//It raise a exception,why?
//If I convert the datetype of "ID" to CHAR(7)
//and pRst->Fields->Item[0L]->Value=L"100",it is ok.
pRst->Update();
pRst->Close();
pConn->Close();
catch (_com_error& e)
MessageBox(e.Description(),"error",MB_OK|MB_ICONWARNING);
return ;
if (pConn)
pConn.Release();
if (pRst)
pRst.Release();
I create a table Aã
create table A
ID number(7)
Now ,I use OLE DB to access the table A;
struct CIsA
CIsA()
memset(this, 0, sizeof(*this));
public:
DB_NUMERIC m_ID;
BEGIN_COLUMN_MAP(CIsA)
COLUMN_ENTRY_PS(1, 7, 0, m_ID)
END_COLUMN_MAP()
DEFINE_COMMAND(CIsA, _T("SELECT ID FROM A"))
CDataSource DataSource;
HRESULT hrt=DataSource.Open(_T("OraOLEDB.Oracle.1"),NULL,_T("ISVISION"),_T("ISVISION"));
CSession Session;
hrt=Session.Open(DataSource);
CDBPropSet propset(DBPROPSET_ROWSET);
propset.AddProperty(DBPROP_IRowsetChange, true);
propset.AddProperty(DBPROP_UPDATABILITY,
DBPROPVAL_UP_INSERT | DBPROPVAL_UP_CHANGE | DBPROPVAL_UP_DELETE);
CCommand<CAccessor<CIsA> > Command;
Command.Open(Session,NULL,&propset);
tcscpy((TCHAR*)Command.mID.val,_T("1245"));
Command.m_ID.sign=1;
hrt=Command.Insert();//It is wrong,why?
Command.Close();
Session.Close();
DataSource.Close();
In Fact,the two problems is the same. The key of problem is how to insert a number into oracle.
help me! thank you.
hi
create a table something like this.
create table image(
Image_Id number(5),
Image blob);create a form with the same table and use the following code.
when-button-pressed trigger.
read_image_file('c:\image_name.jpg' , 'jpg' , 'image.image');if its correct/helpful please mark it thanks.
sarah
Similar Messages
-
How to insert line number into APPLIED_CUSTOMER_TRX_LINE_ID?
Hi All,
I am working on the table of receivable AR_RECEIVABLE_APPLICATIONS_ALL.
I get some information about APPLIED_CUSTOMER_TRX_LINE_ID form TRM.
APPLIED_CUSTOMER_TRX_LINE_ID NUMBER (15)
The line number of the debit item or credit memo to which a payment or credit memo is applied
So, I want to use APPLIED_CUSTOMER_TRX_LINE_ID to join with transaction's line (RA_CUSTOMER_TRX_LINES_ALL).
But after applied the credit memo, the APPLIED_CUSTOMER_TRX_LINE_ID is NULL.
How to insert line number into APPLIED_CUSTOMER_TRX_LINE_ID?Hi Eric,
The application is already at the AR Invoice (header) level. Oracle doesn't give you privilege to apply the invoice at invoice line or distribution level. You need to match the applied_customer_trx_id to customer_trx_id of ra_customer_trx_all to get the applied invoice/debit memo number. Hope my comments are helpful to you.
KG -
How to Insert date in 'DD/MM/YYYY' format in oracle using stored procedure?
Hi
How to Insert date in 'DD/MM/YYYY' format in oracle using stored procedure?
This is my Input data.
11/25/2007.
By using below query, it is inserted into database.
sql>Insert into tblname values(to_date('11/25/2007','MM/DD/YYYY'));
But using stored procedure, the same query is not running.
It shows error like
ORA-01843: not a valid month ORA-06512: at line 1
Procedure:
create or replace procedure Date_Test(datejoin in DATE) is
begin
insert into datetest values(to_date(datejoin,'MM/DD/YYYY'));
end Date_Test;
I had used 'nls_date_language = american' also.
Prcodeure is created but not worked in jsp. The same error is thrown.
Pls provide a solutionThis might help you....
SQL> Create Table DateTest(col1 Date);
Table created.
Elapsed: 00:00:00.00
SQL> create or replace procedure Date_Test(datejoin in DATE) is
2 begin
3 insert into datetest values(to_date(datejoin,'MM/DD/YYYY'));
4 end ;
5 /
Procedure created.
Elapsed: 00:00:00.00
SQL> exec Date_Test('11/25/2007');
BEGIN Date_Test('11/25/2007'); END;
ERROR at line 1:
ORA-01843: not a valid month
ORA-06512: at line 1
Elapsed: 00:00:00.00
SQL> exec Date_Test(To_Date('11/25/2007','mm/dd/yyyy'));
BEGIN Date_Test(To_Date('11/25/2007','mm/dd/yyyy')); END;
ERROR at line 1:
ORA-01843: not a valid month
ORA-06512: at "CTBATCH.DATE_TEST", line 3
ORA-06512: at line 1
Elapsed: 00:00:00.00
SQL> create or replace procedure Date_Test(datejoin in DATE) is
2 begin
3 insert into datetest values(datejoin);
4 end ;
5 /
Procedure created.
Elapsed: 00:00:00.00
SQL> exec Date_Test(To_Date('11/25/2007','mm/dd/yyyy'));
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
SQL> Select * from DateTest;
COL1
25-NOV-07
Elapsed: 00:00:00.00
SQL> create or replace procedure Date_Test(datejoin in VarChar2) is
2 begin
3 insert into datetest values(to_date(datejoin,'mm/dd/yyyy'));
4 end ;
5 /
Procedure created.
Elapsed: 00:00:00.00
SQL> exec Date_Test('11/25/2007');
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
SQL> select * from DateTest;
COL1
25-NOV-07
25-NOV-07
Elapsed: 00:00:00.00
SQL> -
How to insert page number on each page for Cross-Tab report?
Hi,
I have created a Cross-Tab in the section Report Header via Crystal Reports 11.
Now, I want to created more Cross-Tabs, and each page has one Cross-Tab.
So, I insert Report Headers to contain Cross-Tabs. But, the report only shows the page number at the last page.
How to insert page number on each page?
Thanks in advance.Hi,
Well, the easiest solution is to place the Cross-tab in the Report Footer, Of course, ONLY if the report contains this single object which I'm assuming is not the case.
If you do not wish to place the cros-tab in the Report Footer, here's what you need to do:
1) Create a formula;
whilereadingrecords;
2) Create a group on this formula. If the report already contains groups, move this formula to the top of the grouping list. It won't affect the other groups or records in any way.
3) Move the Cross-tab from the Report Header to the Group Header1 and suppress Group Footer1
4) Add the Page Number field to the Page Footer
Let me know how this goes!
-Abhilash -
How to insert the data using matrix
Hi
All how to insert the data using matrix feild
plz help me
thanks
LoyHi Loy,
The best way to fill an entire matrix is to use a DBDatasource, here is some sample code:
Dim oForm As SAPbouiCOM.Form
oForm = SBO_App.Forms.Item("YourFormTypeID")
'1. Add a DBDataSource to the form
oForm.DataSources.DBDataSources.Add("OUSR")
Dim oColumnDBS As SAPbouiCOM.Column
Dim oColumnUDS As SAPbouiCOM.Column
Dim i As Integer
Dim GenEdt As SAPbouiCOM.EditText
Dim oMatrix As SAPbouiCOM.Matrix
Dim oColumns As SAPbouiCOM.Columns
Dim oDBDataSource As SAPbouiCOM.DBDataSource
oMatrix = oForm.Items.Item("7").Specific
oColumns = oMatrix.Columns
'2. DBDataSource: Binding a field / alias of the table to a column
oColumnDBS = oColumns.Item("V_1")
oColumnDBS.DataBind.SetBound(True, "OUSR", "U_NAME")
'3. getting the data sources bound to the form
oDBDataSource = oForm.DataSources.DBDataSources.Item("OUSR")
oMatrix.Clear()
' Querying the DB Data source
oDBDataSource.Query()
' Adding the data to the matrix
oMatrix.LoadFromDataSource()
When you want to fill a specific field use :
GenEdt = oMatrix.Columns.Item("V_2").Cells.Item(1).Specific
GenEdt.String = "Hello" -
How to limit the number of search results returned by oracle text
Hello All,
I am running an oracle text search which returned the following error to my java program.
ORA-20000: Oracle Text error:
DRG-51030: wildcard query expansion resulted in too many terms
#### ORA-29902: Fehler bei der Ausführung von Routine ODCIIndexStart()
ORA-20000: Oracle Text error:
DRG-51030: wildcard query expansion resulted in too many terms
java.sql.SQLException: ORA-29902: Fehler bei der Ausführung von Routine ODCIIndexStart()
ORA-20000: Oracle Text error:
DRG-51030: wildcard query expansion resulted in too many terms
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:169)
When i looked up the net, one suggestion that was given is to narrow the wildcard query, which i cannot in my search page. Hence I am left with the only alternative of limiting the number of results returned by oracle text search query.
Please let me know how to limit the number of search results returned by oracle text so that this error can be avoided.
Thanks in advance
krkHi,
If not set explicitly, the default value for WILDCARD_MAXTERMS is 5000. This is set as a wordlist preference. This means that if your wildcard query matches more than 5000 terms the message is returned. Exceeding that would give the user a lot to sift through.
My suggestion: trap the error and return a meaningful message to the user indicating that the search needs to be refined. Although it is possible to increase the number of terms before hitting maxterms (increase wildcard_maxterms preference value for your wordlist), 5000 records is generally too much for a user to deal with anyway. The search is not a good one since it is not restricting rows adequately. If it happens frequently, get the query log and see the terms that are being searched that generate this message. It may be necessary to add one or more words to a stoplist if they are too generic.
Example: The word mortgage might be a great search term for a local business directory. It might be a terrible search term for a national directory of mortgage lenders though (since 99% of them have the term in their name). In the case of the national directory, that term would be a candidate for inclusion in the stoplist.
Also remember that full terms do not need a wildcard. Search for "car %" is not necessary and will give you the error you mentioned. A search for "car" will yield the results you need even if it is only part of a bigger sentence because everything is based on the token. You may already know all of this, but without an example query I figured I'd mention it to be sure.
As for limiting the results - the best way to do that is to allow the user to limit the results through their query. This will ensure accurate and more meaningful results for them.
-Ron -
How to insert a number into AQ
Hi all,
i am new to oracle AQ, i have to insert a number into oracle AQ. anybody can please explain steps to insert a number in to AQ with sample script. and how would i know that AQ succesfully recieved my number ?
please explain in details ...becoz i don't have primary knowlege even on AQ. thanks.
....Thanks in advance.Hi
Perhaps you should post this here...
Advanced Queueing
Cheers
Ben -
How to return whole number using round function
hi
can i get sql query using round function how to return whole number valueHi welcome to the forum. if you want whole number value what does it mean
1. whether you want the whole number greator than or eqaul to that number example for 12.6 you want 12 or 13
see below example
1. SQL> select round(12.5) from dual;
ROUND(12.5)
13
2. SQL> select round(12.4) from dual;
ROUND(12.4)
12
3. SQL> select floor(12.5) from dual;
FLOOR(12.5)
12
4. SQL> select floor(12.4) from dual;
FLOOR(12.4)
12
floor will always give you a round value which is a integer or whole number less than or equal to but output of rond will differ if the value is greator than 12.5 it will give 13 but if it is less than 12.5 it will give 12, so depending on your requirement you can choose which function to use. similarly if you always want to get the whole number greator than the number you can use ceil as below
SQL> select ceil(12.3) from dual;
CEIL(12.3)
13
SQL> select ceil(12.8) from dual;
CEIL(12.8)
13 -
How to obtain object number using cost center??
hI.
i need to obtain all the cost elemnts of a particular cost center..
cost elemnt can b fetched from COSP using OBJNR..
How do i obtain OBJNR using KOKRS,KOSTL????Hi
From the table
CSSK
take the related Cost elements for a cost center.
Concatenate the cost element with KS and other Orgn unit
and pass to the Costing tables
see an entry in those tables you will know what are the fields in OBJNR that are concatenated
Reward points if useful
Regards
Anji -
How to insert 10 rows at a time in the oracle
how ti insert r update 10 query at a time in the oracle
You can do a small test to find it out.
SQL> set serveroutput on
SQL> drop table t
2 /
Table dropped.
SQL> drop table s
2 /
Table dropped.
SQL> create table s(no integer, name varchar2(4000))
2 /
Table created.
SQL> create table t(no integer, name varchar2(4000))
2 /
Table created.
SQL> insert into s
2 select level, rpad('*',4000,'*')
3 from dual
4 connect by level <= 10000
5 /
10000 rows created.
SQL> commit
2 /
Commit complete.
SQL> declare
2 ltime integer;
3 begin
4 ltime := dbms_utility.get_time;
5
6 for i in (select * from s)
7 loop
8 insert into t(no, name) values(i.no,i.name);
9 end loop;
10
11 ltime := dbms_utility.get_time - ltime;
12
13 dbms_output.put_line('Exec Time:'||ltime/100||' Seconds...');
14 commit;
15 end;
16 /
Exec Time:17.22 Seconds...
PL/SQL procedure successfully completed.
SQL> truncate table t
2 /
Table truncated.
SQL> declare
2 type my_type is table of s%rowtype;
3 lType my_type;
4 ltime integer;
5 begin
6 ltime := dbms_utility.get_time;
7
8 select * bulk collect into lType from s;
9
10 forall i in 1..lType.count
11 insert into t values lType(i);
12
13 ltime := dbms_utility.get_time - ltime;
14
15 dbms_output.put_line('Exec Time:'||ltime/100||' Seconds...');
16
17 commit;
18 end;
19 /
Exec Time:6.27 Seconds...
PL/SQL procedure successfully completed.
SQL> truncate table t
2 /
Table truncated.
SQL> declare
2 ltime integer;
3 begin
4 ltime := dbms_utility.get_time;
5
6 insert into t select * from s;
7
8 ltime := dbms_utility.get_time - ltime;
9
10 dbms_output.put_line('Exec Time:'||ltime/100||' Seconds...');
11
12 commit;
13 end;
14 /
Exec Time:3.26 Seconds...
PL/SQL procedure successfully completed.Thanks,
Karthick. -
How to insert euro symbol from java 1.6 to oracle 10.2.0.4.0
database details is as follows
NLS_CHARACTERSET =WE8ISO8859P1
NLS_NCHAR_CHARACTERSET = AL16UTF16
text column type =NVARCHAR2
i am using set
Array p1arr = new ARRAY(desc1, connection, texts);
and
cst.setArray(textIndex, p1arr);
i am using classes12.jar and ojdbc14.jar
is giving excepting like Cannot map Unicode to Oracle character.Why can't you use the 11.2 drivers? They are certified with 9.2.
The only solution I can give you for older drivers is to give up the array interface and insert the value using setFormOfUse and setString:
http://download.oracle.com/docs/cd/B10501_01/java.920/a96654/oraint.htm#1063992
-- Sergiusz -
How to insert various number of values into a table
Hi
Im devoloping application using swing components..How can i insert values from JTextField to table if the form contains number of textfield(more than 30) and JRadioButtons(Radio Buttons are in button group).
thanks in advance.Hi
i designed a form with 58 Textfields. i want to get data from those fields and i have to store those into a database table. how can i do that .is there any simple way to do that?. do you have any example code? pls give me... -
How to insert data values using Poplist to both block items....
Hi,
I have created a poplist which should return a sequence(which is stored in a db table) and a description .
The sequence(stored in table) is of number datatype and the description is of varchar2.....
I have created the required record group as:
rg_id := Create_Group_From_Query('TEXNIKOS_GROUP', 'select eponymo , to_char(seq_code_ergazomenoy)
from ref_ergazomenos,ref_eidikothta
where ref_ergazomenos.code_eidikothtas_type_id=ref_eidikothta.seq_code_eidikothtas
order by 1');
status := Populate_Group( rg_id );
if (status = 0)
then
POPULATE_LIST('MOD2_KLISI_VLAVIS.TEXNIKOS_FNAME','TEXNIKOS_GROUP');
end if;The field 'MOD2_KLISI_VLAVIS.TEXNIKOS_FNAME' is the description i described above ... and whereas this block item is filled with the selected poplist... the sequence - the code of the db table- is not.....
Is it possible to do so.... ????
NOTE: i use Dev10g.
Many thanks,
SimonI have two block items:
seq_code_ergazomenoy: number datatype , db item , invisible
eponymo:varchar2 datatype , non db item , visible
How to fill these both block items using the written record group...?????
Now , only the "eponymo" block item is filled but not the required "seq_code_ergazomenoy"....
In other words.... is there any manner to do the column mapping of the two selected columns (in the dynamically created record group) to the two block items....????
Thanks,
Simon
Message was edited by:
sgalaxy -
How to get IDoc number using sdata records
Hi Experts,
I have executed a report program in background. Its generating few IDoc's. I can view those idoc's in WE05 also. But now i want to display those idoc number in the result output of the report. One of the segment having materrial number and plant details in the IDoc. Using this details i want to display the IDoc number in the output screen. Even i have tried with EDID4 table its taking huge time to get a single IDoc. Is there is any simplest way is there to get those idoc's .
Otherwise how to achive this?
Thanks and Regards,
MohanaHi,
1.)If you want the ouput in the same report program which triggers the idoc, it is better to use the control record information.
You will get IDoc Number from XEDIDC(check the below code) and you can store the idoc number into an internal table if more idoc is expecting to be triggered.
call function 'MASTER_IDOC_DISTRIBUTE'
exporting
MASTER_IDOC_CONTROL = EDIDC
tables
COMMUNICATION_IDOC_CONTROL = XEDIDC
MASTER_IDOC_DATA = XEDIDD
exceptions
others = 5.
read table xedidc index 1.
append xedidc-docno to it_docno.
And finallly use this to display in the output.
2.) if u want it in a seperate report, then select based on date, idoctype, messagetype
Regards,
Sajith -
HOW TO - Insert large number of rows fast
I have a tables A , B and C and I select some data from A, B and C using some complex criteria.
Table A B and C has 10mil rows.
final rows to be insert into table D is about 3mil.
Currently the rows are inserted one at a time and there are 3 mil inserts in the plsql.
What is the best way to create these rows.
psudocode
begin
for loop ..... loop
--compled selection criteria.
insert into D ..... ;
end loop ;
end ;
SSis there a way to optimize the inserts.The inserts takes very little time
Re: Insert Statement Performance Degradation
In this example the same number of inserts into the same table takes 0.03 seconds to insert 100,000 rows, and 3.06 seconds when looped. If the entire insert operation was optimized away to take zero time, the loop would still take 3.03 seconds, which represents a performance increase of a little under 1%.
As I said it is not a single query by which I build a row for insert into table D, It is
a complex operation which is not necessary to explain here.This is the slow part that needs optimizing.
Maybe you are looking for
-
MSI P35 Neo2 (MS-7345) strange BIOS problem
Hi all, My first post here - just wondering if someone could help me. I recently 'accidentally' flashing my bios version from 1.8 to 1.C on my MS-7345 (P35 Neo 2) board, after deciding to install live update. While I know it's often considered a bad
-
Calculated values: how to? Newbie question
Hi, I have a view object with attributes X and Y (both numbers). How can I add a computed attribute (X*Y) ? I tried to - do "New" attribute in View Object wizard" - then set flag Queriable to false - remove that attribute from the SQL query - edit th
-
My husband and I did the most recent update. Now when we send messages to each other we also receive a duplicate of the message to ourself, what did we do wrong?
-
New Bank A/C Creation Error
Hi everyone, While creating a new bank Account i am getting following error.... "Unable to verify the value entered into the OrgName field. Please select the List of Values icon for this field to select a valid value." this error actually arrises whe
-
Trying to update aperature 1.1
I've had aperature 1.1 for about a week, and had some questions and found this forum. It made mention of two updates to 1.1: 1.1.1 and 1.1.2. When I try to update the updater says aperature 1.1 isn't installed. When I run aperature and check the abou