Do I Have to Commit in PL/SQL block?
Hello all,
i got plsql block in application process after button press like this:
insert into ideas
(IDEA_ID, USER_PID, DESCRIPTION, AREA, PRODUCT_FAMILY, FF, CHANGE_PN, PN_NUMBER, PROBLEM,
SOLUTION, SAVINGS, EVALUATOR_PID, DB_DATE, EVALUATION_TERM, LOC, STATUS, TYPE, POINTS_OR_MONEY,
AUTHOR_NOTE)
values
(zn_no, v ('USER'), :P6_DESCRIPTION, :P6_AREA, :P6_PRODUCT_FAMILY, :P6_FOCUS_FACTORY,
NVL(:P6_CHANGE_PN,'N'), :P6_PN_NUMBER, :P6_PROBLEM, :P6_SOLUTION, :P6_SAVINGS,
:P6_EVALUATOR_NAME, SYSDATE, SYSDATE+14, :F300_LOCATION, 1, 2, DECODE(:F300_LOCATION, 1, 'M', :P6_POINT_OR_MONEY),
:P6_AUTHOR_NOTE);
insert into authors (idea_id, author_pid, participation, group_id)
(select zn_no, author_pid, participation, group_id from tmp_authors where group_id = :P6_AUTHORS_SEQ);
authors.idea_id is foreign key to ideas.idea_id.
But sometimes it only inserts into first table (ideas), but not to second(authors). I thought, that i don't need to commit explicitly, but now i doubt about it.
Do you have any suggestions what else can be wrong?
I'm running Apex 3.0 on Orale 10g r2@SLES9
I've added test for SQL%ROWCOUNT :
IF SQL%ROWCOUNT = 0 THEN
sql_error := 'Page 7: Cannot find the author';
RAISE CANNOT_FIND_AUTHOR;
END IF;
When, if raised, i'll call rollback. I guess this should be enough to ensure that both insert statement was success.
Similar Messages
-
Commit in pl/sql block;
Hi Gurus,
I have a task to delete Parent/child table records (On Delete: No action). I was getting integrity constraint error while I was trying to delete a parent record(this is obvious).
I wrote a pl/sql block to perform this action.
Version: 11.2
begin
delete from child;
Commit; -- --> Can I ignore it ?
delete from Parent;
Commit;
end;
Do I need to write a commit after deleting the record from child table ?.
Thanks in Advance.
--Herndon.
Edited by: Herndon on Jan 31, 2013 3:29 PMHerndon wrote:
Hi Gurus,
I have a task to delete Parent/child table records (On Delete: No action). I was getting integrity constraint error while I was trying to delete a parent record(this is obvious).
I wrote a pl/sql block to perform this action.
Version: 11.2
begin
delete from child;
Commit; -- --> Can I ignore it ?
delete from Parent;
Commit;
end;
Do I need to write a commit after deleting the record from child table ?.
Thanks in Advance.
--Herndon.
Edited by: Herndon on Jan 31, 2013 3:29 PMYou should remove the first COMMIT. You need to carry out the deleation of child and parent as a single transaction. So your delete statements must be like
begin
delete from child;
delete from parent;
commit;
end;
/Because if your parent delete fails then the child records that are already deleted will be ROLLBACK'ed. -
Alter table then Update in PL/SQL block
I am trying to alter the table then update it :
declare
colCount number;*
begin*
select count(*) into colCount from all_tab_cols where table_name = 'TEST' and owner = 'TEST_OWNER';*
dbms_output.put_line('No of Columns in the table : ' || colCount);*
if colCount = 2 then*
dbms_output.put_line('Table needs upgrade');*
execute immediate('ALTER TABLE TEST ADD COL1 VARCHAR2(100) NULL');*
UPDATE TEST SET COL1 = '123';*
commit;*
else*
dbms_output.put_line('No Changes Required');*
end if;*
end;*
Oracle complains that "COL1" is an invalid identifier.
I also tried substitute the UPDATE statement with
** execute immediate('UPDATE TEST SET VCHCHARSET_OUT='UTF8' WHERE VCHCHARSETNAME='UTF8'');**
and there is something wrong with the construction of an Update statement in the parenthesis.
Am I taking the right approach and just need to figuire out the syntax of single quotes or something else is wrong?
thanks in advance.Yes, you are absolutely right, I shouldn't alter the table and then update the values.
The reason I need to do it relates to the migration process we utilize in our company. Initially I had a set of SQL commands which I executed migrating from one environment to another and eventually to Production. I had an error in the last SQL command which caused migration process to produce "Failure", however the table was already altered and all the rows except the last one were updated. Since I can't successfully migrate to Production with the failed process I have to generate a PL/SQL block which will take in consideration that in one environment the table has already been modified and in the other one is still needs to be changed. -
Write an UPdate statement using the logic used in PL/SQL block (oracle 10g)
Hi All,
I have written the following PL/SQL block. I want to write an UPDATE statement using the logic used in the following PL/SQL block. can any one please help me out in this regards.
DECLARE
v_hoov_fag gor_gold_post.hoov_flg%TYPE;
v_b49n gor_gold_post.b49n%TYPE;
CURSOR c
IS
SELECT bs_id, loyalty_date, loyalty_period, contract_date
FROM gor_gold_post
WHERE tariff_code IN (169, 135, 136);
BEGIN
FOR rec IN c
LOOP
IF (TRUNC (ADD_MONTHS (rec.loyalty_date, rec.loyalty_period)
- SYSDATE) < 304
OR ( TRUNC ( ADD_MONTHS (rec.loyalty_date, rec.loyalty_period)
- SYSDATE
) IS NULL
AND (SYSDATE - TO_DATE (rec.contract_date, 'YYYYMMDD')) > 91.2
THEN
v_hoov_flg := 1;
ELSE
v_hoover_flag := 99;
END IF;
IF (TRUNC (ADD_MONTHS (rec.loyalty_date, rec.loyalty_period)
- SYSDATE) < 121.6
OR ( TRUNC ( ADD_MONTHS (rec.loyalty_date, rec.loyalty_period)
- SYSDATE
) IS NULL
AND (SYSDATE - TO_DATE (rec.contract_date, 'YYYYMMDD')) > 91.2
THEN
v_b49n := 1;
ELSE
v_b49n := 99;
END IF;
UPDATE gor_gold_post
SET hoov_flg = v_hoov_flg,
b49n = v_b49n
WHERE bs_id = rec.bs_id AND tariff_code IN (169, 135, 136);
COMMIT;
END LOOP;
END;Thank you,Using case statement.
UPDATE gor_gold_post
SET hoov_flag = CASE WHEN TRUNC (ADD_MONTHS (rec.loyalty_date, rec.loyalty_period) - SYSDATE) < 304
OR
(TRUNC (ADD_MONTHS (rec.loyalty_date, rec.loyalty_period) - SYSDATE) IS NULL
AND (SYSDATE - TO_DATE (rec.contract_date, 'YYYYMMDD')) > 91.2)
THEN 1
ELSE 99
END,
b49n = CASE WHEN TRUNC (ADD_MONTHS (rec.loyalty_date, rec.loyalty_period) - SYSDATE) < 121.6
OR
(TRUNC (ADD_MONTHS (rec.loyalty_date, rec.loyalty_period) - SYSDATE) IS NULL
AND (SYSDATE - TO_DATE (rec.contract_date, 'YYYYMMDD')) > 91.2)
THEN 1
ELSE 99
END
WHERE tariff_code IN (169, 135, 136);Note: Code not tested. -
Running a anonymous PL/SQL block
Hi,
I have created an anonymous PL/SQL block and saved it in a file. And I am now trying to run it from the sql prompt using @.
But this doesn't seem to be working. I get a wierd number as output and then it hangs.
This is not the case if I copy paste the anonymous block. In this case I get the correct output.
Please assist as to whether it is possible to run it using @ as it is important for me to do so..Hi,
You forgot the slash after the anonymous block:
USER is "YJAM"
TEST>-- Create anonymous Block
TEST>BEGIN
2 NULL;
3 END;
4 /
PL/SQL procedure successfully completed.
TEST>-- save as script
TEST>save ab.sql
Created file ab.sql
TEST>get ab
1 BEGIN
2 NULL;
3* END;
TEST>@ab
PL/SQL procedure successfully completed.
TEST>ed ab Here, I delete line 4. hence the Block won't run.
TEST>@ab
4
5
6
7
8 . a dot to exit input mode. a slash would run the block
TEST>Regards,
Yoann. -
Call to concurrent program in a pl/sql block does not COMMIT data to table
I have the following PL/SQL block.
apps.create_po(x_org_id,x_document_num,x_agent_name,x_vendor_id,x_vendor_site_id,x_ship_to_location,x_bill_to_location,x_creation_date,new_isbn,new_print_key,new_unit_setup_cost,new_unit_run_cost,x_item,x_category_id,x_item_description,x_unit_of_measure,x_quantity,x_unit_price,x_ship_to_org_id,x_promise_date,x_qty_rcv_tolerance, x_deliver_to_location,x_destination_org_id, x_destination_subinventory,x_segment2,x_segment4);
COMMIT;
FND_GLOBAL.APPS_INITIALIZE(v_user_id,v_resp_id,201);
v_po_req_id := apps.fnd_request.submit_request('PO','POXPOPDOI',NULL,NULL,NULL,
NULL,'STANDARD',NULL,'Y',NULL,'APPROVED',NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL
DBMS_OUTPUT.PUT_LINE('Request ID is:' || v_po_req_id);
IF v_po_req_id <> 0 THEN
dbms_lock.sleep(60);
dbms_output.Put_line('Sleep executed');
COMMIT;
select PHASE_CODE,STATUS_CODE INTO v_phase_code,v_status_code
FROM FND_CONCURRENT_REQUESTS
WHERE REQUEST_ID = v_po_req_id;
dbms_output.put_line('After commit Phase and status codes are = '||v_phase_code || v_status_code);
ELSE
ROLLBACK;
END IF;
dbms_output.put_line('New Po is' || x_document_num);
dbms_output.put_line('Quantity Is'|| x_quantity);
apps.receive_po(x_document_num,x_quantity);
v_rcv_req_id := apps.fnd_request.submit_request('PO','RVCTP',NULL,NULL,NULL,
'BATCH',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL
DBMS_OUTPUT.PUT_LINE('Request ID is:' || v_rcv_req_id);
IF v_rcv_req_id <> 0 THEN
COMMIT;
DBMS_OUTPUT.PUT_LINE('COMMITED RECEIVING');
ELSE
ROLLBACK;
END IF;
Presently when this block runs, i can see the new PO number created. Commit is also successfully executed. The last output for the program is
New Po is 20651
Quantity Is 450
But due to some reason, the receiving program(receive_po) cannot retrieve the same PO from the base table.
But once this pl/sql block is complete, and i call the receving procedure from a different session, the Po is retrieved and receiving against the PO is executed successfully.
Can someone please suggest a work around ? Is the code missing something ? Since POXPOPDOI is a concurrent program which is executed as an asyncronous process, the commit statement after the call to concurent program does not work but the commit is executed only after it exits the pl/sql block.Thanks for responding.
receive_po() program just inserts the data into RCV_HEADERS_INTERFACE and RCV_TRANSACTIONS_INTERFACE tables based on the PO that is created in the previous step. So basically the new PO created has to be received and the receive_po() just inserts data into the interface tables so that RVCTP can be called after that for receiving.
Here is the code for the procedure.
SET SERVEROUTPUT ON;
--FND_GLOBAL.APPS_INITIALIZE(3,20707,201);
--Procedure for receiving interface to load data to RCV_HEADERS_INTERFACE and RCV_TRANSACTIONS_INTERFACE
CREATE OR REPLACE PROCEDURE receive_po (x_ponum IN VARCHAR2,x_quantity IN NUMBER) AS
v_vendor_site_id NUMBER;
v_vendor_id NUMBER;
v_agent_id NUMBER;
v_ship_to_organization_id NUMBER;
v_item_id NUMBER;
v_uom_code varchar2(25);
v_subinventory varchar2(25);
v_ship_to_location_id NUMBER;
BEGIN
--header information in variables
dbms_output.put_line('Entering Receiving Insert Procedure');
dbms_output.put_line('Po number ='||x_ponum||'$');
dbms_output.put_line('Quantity is ='||x_quantity||'$');
select pvsa.vendor_site_id into v_vendor_site_id
FROM po_headers_all pha,po_vendors pv, po_vendor_sites_all pvsa
where pha.vendor_id = pv.vendor_id
and pv.vendor_id = pvsa.vendor_id
and pha.segment1 = x_ponum;
dbms_output.put_line('Vendor Site ID is' ||v_vendor_site_id);
select pv.vendor_id into v_vendor_id
FROM po_headers_all pha,po_vendors pv, po_vendor_sites_all pvsa
where pha.vendor_id = pv.vendor_id
and pv.vendor_id = pvsa.vendor_id
and pha.segment1 = x_ponum;
dbms_output.put_line('Vendor ID is' ||v_vendor_id);
select plla.SHIP_TO_ORGANIZATION_ID into v_ship_to_organization_id
from PO_HEADERS_ALL pha, PO_LINE_LOCATIONS_ALL plla
where pha.PO_HEADER_ID = plla.PO_HEADER_ID
and pha.segment1 = x_ponum;
dbms_output.put_line('Ship to org is' ||v_ship_to_organization_id);
select agent_id into v_agent_id
FROM po_headers_all
WHERE segment1 = x_ponum;
dbms_output.put_line('Agent ID is' ||v_agent_id);
--printing header table information
dbms_output.put_line('vendor id is:'||v_vendor_id);
dbms_output.put_line('vendor site id is:'||v_vendor_site_id);
dbms_output.put_line('agent id is:'||v_agent_id);
dbms_output.put_line('ship to organization id is:'||v_ship_to_organization_id);
--line information in variables
--derive item id
select pla.item_id into v_item_id
from po_headers_all pha, po_lines_all pla
where pha.po_header_id = pla.po_header_id
and pha.org_id = pla.org_id
and pha.segment1 = x_ponum;
--derive uom
select pla.unit_meas_lookup_code into v_uom_code
from po_headers_all pha, po_lines_all pla
where pla.po_header_id = pha.po_header_id
and pla.org_id = pha.org_id
and pha.segment1 = x_ponum;
--derive subinventory
select pda.destination_subinventory into v_subinventory
from po_headers_all pha, po_lines_all pla,po_distributions_all pda
where pha.po_header_id = pla.po_header_id
and pla.po_header_id = pda.po_header_id
and pla.po_line_id = pda.po_line_id
and pha.org_id = pla.org_id
and pla.org_id = pda.org_id
and pha.segment1 = x_ponum;
--derive ship to location id
select ship_to_location_id into v_ship_to_location_id
from po_headers_all
where segment1 = x_ponum;
--printing transaction table details
dbms_output.put_line('item id is:'||v_item_id);
dbms_output.put_line('UOM is:'||v_uom_code);
dbms_output.put_line('subinventory is:'||v_subinventory);
dbms_output.put_line('ship to location id is:'||v_ship_to_location_id);
--insert data into the receiving interface header table
INSERT INTO RCV_HEADERS_INTERFACE
HEADER_INTERFACE_ID ,
GROUP_ID ,
PROCESSING_STATUS_CODE ,
RECEIPT_SOURCE_CODE ,
TRANSACTION_TYPE ,
LAST_UPDATE_DATE ,
LAST_UPDATED_BY ,
LAST_UPDATE_LOGIN,
CREATION_DATE ,
CREATED_BY ,
VENDOR_ID ,
VENDOR_SITE_ID ,
SHIP_TO_ORGANIZATION_ID ,
EXPECTED_RECEIPT_DATE ,
EMPLOYEE_ID ,
VALIDATION_FLAG
SELECT
RCV_HEADERS_INTERFACE_S.NEXTVAL,
RCV_INTERFACE_GROUPS_S.NEXTVAL,
'PENDING',
'VENDOR',
'NEW', -- 'CANCEL',
sysdate,
3,
3,
sysdate,
3,
v_vendor_id,
v_vendor_site_id,
v_ship_to_organization_id,
sysdate+5,
v_agent_id,
'Y'
FROM DUAL;
commit;
--insert data into the interface transaction table
for i in 1..1 loop
INSERT INTO RCV_TRANSACTIONS_INTERFACE
(INTERFACE_TRANSACTION_ID ,
HEADER_INTERFACE_ID ,
GROUP_ID ,
LAST_UPDATE_DATE ,
LAST_UPDATED_BY ,
CREATION_DATE ,
CREATED_BY ,
LAST_UPDATE_LOGIN,
TRANSACTION_TYPE ,
TRANSACTION_DATE ,
PROCESSING_STATUS_CODE ,
PROCESSING_MODE_CODE ,
TRANSACTION_STATUS_CODE ,
QUANTITY ,
UNIT_OF_MEASURE ,
ITEM_ID ,
AUTO_TRANSACT_CODE ,
RECEIPT_SOURCE_CODE ,
SOURCE_DOCUMENT_CODE ,
SUBINVENTORY ,
DOCUMENT_NUM ,
SHIP_TO_LOCATION_ID ,
VALIDATION_FLAG
SELECT
RCV_TRANSACTIONS_INTERFACE_S.NEXTVAL,
RCV_HEADERS_INTERFACE_S.CURRVAL,
RCV_INTERFACE_GROUPS_S.CURRVAL,
SYSDATE,
3,
SYSDATE,
3,
3,
'RECEIVE', --'RECEIVE', -- 'SHIP', --'06-JAN-1998',--question here
sysdate,
'PENDING',
'BATCH',
'PENDING',
x_quantity,
v_uom_code,
v_item_id,
'DELIVER', -- 'RECEIVE', --'DELIVER',
'VENDOR',
'PO',
v_subinventory,
x_ponum,
v_ship_to_location_id,
'Y'
FROM DUAL;
end loop;
commit;
END receive_po;
I am really stuck and looking out for work arond. Please help.
Thanks,
Natasha -
Comma delimeted string in IN clause of PL/SQL block
Hi,
I am using string having comma separted string in IN clause of PL/SQL block.
But it does not give me right result.
If i m using sql query then give me result.
I m using oracl 10g and following code. DEPT table having 'miller' and 'cleark' ename rows.
Can you please suggest the other way to get proper result.
declare
cnt number:=0;
strin varchar2(40);
begin
strin:='miller,cleark';
select count(*)
into cnt
from dept
where ename in (strin);
dbms_output.put_line('cnt:-'||cnt);
end;Thanks.Apart from the solutions you've already been given, let's be clear...
user548963 wrote:
I am using string having comma separted string in IN clause of PL/SQL block.
But it does not give me right result.Yes it does, it's giving exactly the expected result for what you have provided. It may not be what you're desiring, but it's absolutely correct.
The IN Clause is expecting multiple arguments to be in the set of data. You are providing it with a single argument... a single string. Just because your string has got commas in it does not make that string into multiple arguments. -
Hello All,
Is this possible to set Auto Commit on/off
between DM statements in a PL/SQL block
Please suggest me.
Thanks in advance.No, you will have to explicitly issue a COMMIT or ROLLBACK when it makes sense to do it.
The autocommit feature of SQL*Plus (a client application) is not available inside PL/SQL.
However, an entire PL/SQL block when run from SQL*Plus would be considered as one statement (unit) and autocomit (if enabled) will commit all DML statements performed inside the PL/SQL block (and any blocks called from it).
Generally, its not a good idea to use this autocommit feature (even if available) since you lose all the control over your transactions. Your transaction never spans one single statement at a time. -
How to auto commit in pl/sql
Hello,
I am calling a PL/SQL procedure from a JDeveloper program. My connection is an "auto-commit" connection, but still, the PL/SQL is not committed until the procedure returns. Is it possible to avoid this, so that every single statement in the PL/SQL is committed immediately?
Regards
JakobA PL/SQL block reprsents a single unit of work that either commits or rollbacks. In that sense, that is how it is designed to behave. If you need otherwise, you would have to explicitly place COMMIT statements at appropriate locations.
-
Commit after PL/SQL procedure successfully completed?
Hello. I have a question, it may be stupid but here goes:
When I run a script like this do I have to commit after it is completed?
SQL> @merge_candidates_INC933736.sql
PL/SQL procedure successfully completed.XerXi wrote:
Hello. I have a question, it may be stupid but here goes:
When I run a script like this do I have to commit after it is completed?
SQL> @merge_candidates_INC933736.sql
PL/SQL procedure successfully completed.
How would anyone know? You didn't post what the script does.
If the script contains nothing but DDL to create objects then you do NOT need to add a COMMIT since Oracle wil implictily commit DDL statements.
A COMMIT should be performed at the END of a transaction. Since we don't know what, if any DML is contained in your script we have no idea how many transactions might be represented.
So for scripts that contain DML you should add a COMMIT to the script after each transaction has been completed. -
I am trying to have access tables of the Sql Server through the Oracle
I am trying to have access tables of the Sql Server through the Oracle and this being occurred the error:
ORA-28500: connection from ORACLE to a non-Oracle system returned this message: [Generic Connectivity using ODBC][H006] The init parameter <HS_FDS_CONNECT_INFO> is not set.
Please set it in init <orasid>.ora file.
ORA-02063: preceding 2 lines from HSMSQL
I created the ODBC with name HSMSQL.
I made all the configurations in the archives
tnsnames.ora:
HSMSQL=
(DESCRIPTION=
(ADDRESS= (PROTOCOL = tcp)(HOST = wsus)(PORT = 1521))
(CONNECT_DATA =
(SID = HSMSQL)
(HS = OK)
listener.ora:
(SID_DESC = (SID_NAME=HSMSQL)
(ORACLE_HOME= C:\oracle\ora92)
(PROGRAM =hsodbc)
initHS_SID.ora:
HS_FDS_CONNECT_INFO = HSMSQL
HS_FDS_TRACE_LEVEL = OFF
-- Create database link
create database link HSMSQL.US.ORACLE.COM
connect to TESTE identified by TESTE2
using 'HSMSQL';
But when I execute query the error occurs:
Select * from TabTeste@HSMSQL
ORA-28500: connection from ORACLE to a non-Oracle system returned this message: [Generic Connectivity using ODBC][H006] The init parameter <HS_FDS_CONNECT_INFO> is not set.
Please set it in init <orasid>.ora file.
ORA-02063: preceding 2 lines from HSMSQL
Please they help me, thanks, Paulo.Hi,
It seems that your configuration is Ok. By the way, the workaround for this error is:
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
[Transparent gateway for ODBC][H001] The environment variable <HS_FDS_CONNECT_INFO> is not set.
* Set HS_FDS_CONNECT_INFO in the hs{sid}init.ora file to the data source name.
Example: HS_FDS_CONNECT_INFO = <ODBC DataSource Name>
* Make sure the hs{sid}init.ora file exists in the ORACLE_HOME/hs/admin directory and has the same name as the SID in the LISTENER.ORA.
Example: If SID=hsodbc in the listener.ora file, then the hs{sid}init.ora file would be named ORACLE_HOME/hs/admin/inithsodbc.ora
For more information see if this [url http://forums.oracle.com/forums/thread.jspa?forumID=61&threadID=576975]thread can help you.
Cheers -
I have problem with login in sql Server give me support .pre login handshake
I have problem with login in sql Server give me support .pre login handshake
The following threads are on the same topic:
http://www.sql-server-performance.com/forum/threads/pre-login-handshake-error-when-connecting-to-db.687/
http://stackoverflow.com/questions/12308340/sql-server-2000-connection-error-pre-login-handshake
http://dbaspot.com/sqlserver-server/458011-error-occurred-during-pre-login-handshake-microsoft-sql-server-error-10054-a.html
Kalman Toth Database & OLAP Architect
IPAD SELECT Query Video Tutorial 3.5 Hours
New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012 -
Why do i have to init a VARCHAR for a SELECT in a Pro*C PL/SQL block?
Hi,
i use PL/SQL Block in a Embedded C Programm and compile with the PRO*C Compiler. Oracle 10gR2.
When i Select .. Into a VARCHAR bind variable, i have to initialize the variable before, otherwise i get an ORA-1458.
Same problem with assignments to VARCHAR variables.
Question: why do i need to initialize the variable?
Tnx for your help!
The following test program shows my issue:
#include <stdio.h>
#include <string.h>
#include "oraca.h"
#include "sqlca.h"
#define USER "scott"
#define PASSWORD "tiger"
int main()
EXEC SQL BEGIN DECLARE SECTION;
char *db_user = USER;
char *db_passw = PASSWORD;
VARCHAR sysdate_str[64];
EXEC SQL END DECLARE SECTION;
EXEC SQL CONNECT :db_user identified by :db_passw;
/* this works */
sysdate_str.len = 1000; /* invalid length */
EXEC SQL SELECT
to_char( sysdate, 'dd.mm.yy hh24:mi:ss' )
into :sysdate_str
from DUAL
printf ("sqlca.sqlcode %d\n", sqlca.sqlcode);
/* following code does not work, sqlcode = - 1458 */
/* 01458, 00000, "invalid length inside variable character string" */
sysdate_str.len = 1000; /* invalid length */
EXEC SQL EXECUTE
BEGIN
select to_char( SYSDATE, 'dd.mm.yy hh24:mi:ss')
into :sysdate_str
from dual;
END;
END-EXEC;
printf ("sqlca.sqlcode %d\n", sqlca.sqlcode);
/* following code does not work, sqlcode = - 1458 */
/* 01458, 00000, "invalid length inside variable character string" */
sysdate_str.len = 1000; /* invalid length */
EXEC SQL EXECUTE
BEGIN
:sysdate_str := to_char( SYSDATE, 'dd.mm.yy hh24:mi:ss');
END;
END-EXEC;
printf ("sqlca.sqlcode %d\n", sqlca.sqlcode);
return(0);
Edited by: jjaeckel on May 5, 2010 8:37 PMjjaeckel wrote:
When i Select .. Into a VARCHAR bind variable, i have to initialize the variable before, otherwise i get an ORA-1458.A bind variable in a SQL is simply a place holder. The SQL engine has no idea what data type the value for that placeholder will be. When itself needs to return a value via that placeholder to the caller, it needs to know what the limits/size of the caller's variable is that will be receiving the value from it.
The way that the SQL engine knows what the data type and size are of a placeholder/bindvar, is by you the caller, telling it.. by binding the variable you will be using, to this placeholder.
This bind process "exposes" the data type and size of the variable that will be used for binding (sending/receiving data). -
Does Oracle have Extended Stored Procedure like SQL Server and Sybase?
Hi, i am new to Oracle. I want to know if...
Does Oracle have Extended Stored Procedure like SQL Server and Sybase?
If it does not have, then how can i call outside program written in C or JAVA from the Database stored procedure or trigger?refer to this link on external procedures
http://download-west.oracle.com/docs/cd/A87860_01/doc/server.817/a76956/manproc.htm#11064 -
You have an error in your SQL syntax;
i have a checkout page that i am trying to send to a payment centre but and getting the following error
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '16)' at line 1
can someone help and tell me what this means does it mean "conflict with columns definitions"
if so what can i do to solve the issue? do you need to see the page code?
thanks<?php require_once('Connections/wibbles.php'); ?>
<?php
// do not cache
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header ("Cache-Control: no-cache, must-revalidate"); // /1.1
header ("Pragma: no-cache"); // /1.0
// *** Restrict Access To Page: Grant or deny access to this page
$FX_authorizedUsers=" ";
$FX_authFailedURL="login.php";
$FX_grantAccess=0;
if (!session_id()) session_start();
if (isset($_SESSION["MM_Username"])) {
if (true || !(isset($_SESSION["MM_UserAuthorization"])) || $_SESSION["MM_UserAuthorization"]=="" || strpos($FX_authorizedUsers, $_SESSION["MM_UserAuthorization"])) {
$FX_grantAccess = 1;
if (!$FX_grantAccess) {
$FX_qsChar = "?";
if (strpos($FX_authFailedURL, "?")) $FX_qsChar = "&";
$FX_referrer = "Restricted Area";
$FX_authFailedURL = $FX_authFailedURL . $FX_qsChar . "accessdenied=" . urlencode($FX_referrer);
header("Location: $FX_authFailedURL");
exit;
// *** Retrieve X ID ***
if (!session_id()) session_start();
$XC_OrderIdSessionVar = "OrderID";
if (!isset($_SESSION[$XC_OrderIdSessionVar])) {
// Get a unique OrderID number and save to session.
$XC_tableName = "wibble_nextorder";
$XC_fieldName = "NextOrderID";
mysql_select_db($database_wibbles, $wibbles);
$XC_IdSource = "select " . $XC_fieldName . " from " . $XC_tableName;
$XC_rsId = mysql_query($XC_IdSource, $wibbles) or die(mysql_error());
$row_XC_rsId = mysql_fetch_assoc($XC_rsId);
$_SESSION[$XC_OrderIdSessionVar] = $row_XC_rsId[$XC_fieldName];
$$XC_OrderIdSessionVar = $_SESSION[$XC_OrderIdSessionVar];
session_register($XC_OrderIdSessionVar);
$XC_next = $_SESSION[$XC_OrderIdSessionVar] + 1;
$XC_upd = "update " . $XC_tableName . " set " . $XC_fieldName . " = " . $XC_next;
$XC_rsId = mysql_query($XC_upd, $wibbles) or die(mysql_error());
$XC_rsId = null;
// x limit validation
if (isset($_POST["XC_Limit"]) && $_POST["XC_Limit"] != "") {
$XC_limErr = stripslashes($_POST["XC_Limit"]);
if (isset($_GET['XC_SaveCartToTable'])) unset($_GET['XC_SaveCartToTable']);
unset($HTTP_POST_VARS);
unset($_POST);
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
return $theValue;
// x limit validation
if (isset($_POST["XC_Limit"]) && $_POST["XC_Limit"] != "") {
$XC_limErr = stripslashes($_POST["XC_Limit"]);
if (isset($_GET['XC_SaveCartToTable'])) unset($_GET['XC_SaveCartToTable']);
unset($_POST);
unset($_POST);
// Validate X amount
if (isset($_POST["XC_Amount"]) && $_POST["XC_Amount"] < 10) {
if (isset($_GET['XC_SaveCartToTable'])) unset($_GET['XC_SaveCartToTable']);
unset($_POST);
unset($_POST);
$XC_amErr = "The amount doesn't reach the allowed minimum of € 100.";
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
return $theValue;
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO wibble_orders (OrderID, CustomerID, OrderDate, Shipping, Discount, Tax, Total) VALUES (%s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['OrderID'], "int"),
GetSQLValueString($_POST['CustomerID'], "int"),
GetSQLValueString($_POST['OrderDate'], "date"),
GetSQLValueString($_POST['Shipping'], "double"),
GetSQLValueString($_POST['Discount'], "double"),
GetSQLValueString($_POST['Tax'], "double"),
GetSQLValueString($_POST['XC_Amount'], "double"));
mysql_select_db($database_wibbles, $wibbles);
$Result1 = mysql_query($insertSQL, $wibbles) or die(mysql_error());
// *** X Shopping Cart ***
$useSessions = true;
$XCName = "wibbleJakeCart";
$XCTimeout = 30;
$XC_ColNames=array("ProductID","Quantity","Name","Color","Price","MinQty","Discount","Stoc k","Total");
$XC_ComputedCols=array("","","","","","","","","Price");
require_once('XCInc/XCart.inc');
$colname_rsCustomer = "1";
if (isset($_SESSION['MM_UserAuthorization'])) {
$colname_rsCustomer = $_SESSION['MM_UserAuthorization'];
mysql_select_db($database_wibbles, $wibbles);
$query_rsCustomer = sprintf("SELECT * FROM wibble_customers WHERE CustomerID = %s", GetSQLValueString($colname_rsCustomer, "int"));
$rsCustomer = mysql_query($query_rsCustomer, $wibbles) or die(mysql_error());
$row_rsCustomer = mysql_fetch_assoc($rsCustomer);
$totalRows_rsCustomer = mysql_num_rows($rsCustomer);
// *** Redirect if XCart is Empty ***
$XC_RedirectIfEmpty = "shopping-cart.php";
if (isset($_SERVER["QUERY_STRING"])) {
$XC_RedirectIfEmpty .= "?" . htmlentities($_SERVER["QUERY_STRING"]);
if (isset(${$XCName}["contents"]) && (sizeof(${$XCName}["contents"][0]) == 0)) header("Location: " . $XC_RedirectIfEmpty);
// *** Repeat XCart region *** (do not remove this label)
// validate x limit
$XC_invalidItems = "";
$XC_lim = "";
$iCol = array_search("Quantity",${$XCName}["ColNames"]);
$iSrc = array_search("Stock",${$XCName}["ColNames"]);
for ($iVal=0; $iVal<sizeof(${$XCName}["contents"][0]); $iVal++) {
if (${$XCName}["contents"][$iCol][$iVal] > ${$XCName}["contents"][$iSrc][$iVal]) {
if ($XC_invalidItems != "") $XC_invalidItems .= "-";
$XC_invalidItems .= (string) ($iVal+1);
if ($XC_lim != "") $XC_lim .= "-";
$XC_lim .= (string) ${$XCName}["contents"][$iSrc][$iVal];
if ($XC_invalidItems != "") {
$XC_invalidItems = "(".$XC_invalidItems.")";
$XC_lim = "(".$XC_lim.")";
$x_limErr = "The item(s) $XC_invalidItems exceed the available stock of $XC_lim";
// *** Add shipping based on Range
mysql_select_db($database_wibbles, $wibbles);
$XC_sourceVal = $XCart_sumTotal;
$XC_ShipSource = "SELECT Shipping FROM wibble_shipbyprice WHERE MinPurchase < " . $XC_sourceVal . " AND MaxPurchase >= " . $XC_sourceVal;
$XC_rsShip = mysql_query($XC_ShipSource, $wibbles) or die(mysql_error());
$row_XC_rsShip = mysql_fetch_assoc($XC_rsShip);
$XC_Shipping = $row_XC_rsShip['Shipping'];
$XC_rsShip = null;
// *** Add Referenced Sales Tax
mysql_select_db($database_wibbles, $wibbles);
$XC_taxSource = "SELECT Tax FROM wibble_tax WHERE Country = '" . $row_rsCustomer['Country'] . "'";
$XC_rsTax = mysql_query($XC_taxSource, $wibbles) or die(mysql_error());
$row_XC_rsTax = mysql_fetch_assoc($XC_rsTax);
$XC_Tax = $row_XC_rsTax['Tax'];
$XC_rsTax = null;
$XC_SalesTax = $XC_Tax*($XCart_sumTotal+$XC_Shipping-$XC_Discount);
// *** Compute Grand Total
$XC_GranTotal = $XCart_sumTotal+$XC_SalesTax+$XC_Shipping-$XC_Discount;
// *** Format table as Europe style
if (!session_id()) session_start();
// set header
$XC_header = "<style type=\"text/css\">\n<!--\n";
$XC_header .= "table {font-family: Arial, Helvetica, sans-serif; font-size: 13px;}\n";
$XC_header .= "-->\n</style>\n";
$XC_header .= "<table width=\"520\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
$XC_header .= " <tr>\n <td>\n";
$XC_header .= "<table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\">\n";
$XC_header .= " <tr>\n <td> </td>\n <td align=\"right\"> </td>\n </tr>\n";
$XC_header .= " <tr>\n <td>Order n. <b>" . $_SESSION["OrderID"] . "</b></td>\n <td align=\"right\"> " . date("d/m/Y") . "</td>\n </tr>\n";
$XC_header .= " <tr>\n <td> </td>\n <td> </td>\n </tr>\n";
$XC_header .= " <tr>\n <td colspan=\"2\" align=\"Left\">";
$XC_header .= $row_rsCustomer["FirstName"] . " ";
$XC_header .= $row_rsCustomer["LastName"] . " <br>";
$XC_header .= $row_rsCustomer["Address"] . " <br>";
$XC_header .= $row_rsCustomer["ZIP"] . " ";
$XC_header .= $row_rsCustomer["City"] . " ";
$XC_header .= $row_rsCustomer["State"] . " <br>";
$XC_header .= $row_rsCustomer["Country"] . " <br>";
$XC_header .= "</td>\n </tr>\n</table>\n";
$XC_header .= "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\">\n";
$XC_header .= " <tr>\n <td colspan=\"5\"> </td>\n </tr>\n";
$XC_header .= " <tr>\n <td colspan=\"5\">Cart contents: </td>\n </tr>\n";
// set cart data
$XCartData = " <tr>\n";
$XCartData .= " <th width=\"30\" bgcolor=\"#CC6600\"><font color=\"white\">Qty</font></th>\n";
$XCartData .= " <th width=\"310\" bgcolor=\"#CC6600\"><font color=\"white\">Description</font></th>\n";
$XCartData .= " <th width=\"60\" bgcolor=\"#CC6600\"><font color=\"white\">Price</font></th>\n";
$XCartData .= " <th width=\"40\" bgcolor=\"#CC6600\"><font color=\"white\">Disc</font></th>\n";
$XCartData .= " <th width=\"80\" bgcolor=\"#CC6600\"><font color=\"white\">Total</font></th>\n";
$XCartData .= " </tr>\n";
for ($jRow=0; $jRow<sizeof(${$XCName}["contents"][0]); $jRow++) {
require('XCInc/RepeatXMailRegion.inc');
$XCartData .= " <tr>\n";
$XCartData .= " <td align=\"Center\" bgcolor=\"#FFFF99\">" . ${$XCName}["contents"][1][$jRow] . "</td>\n";
$XCartData .= " <td align=\"Left\" bgcolor=\"#FFFF99\">" . ${$XCName}["contents"][2][$jRow] . "</td>\n";
$XCartData .= " <td align=\"Right\" bgcolor=\"#FFFF99\">€ " . number_format(${$XCName}["contents"][4][$jRow], 2, ',', '.') . "</td>\n";
$XCartData .= " <td align=\"Center\" bgcolor=\"#FFFF99\">" . ${$XCName}["contents"][6][$jRow] . "</td>\n";
$XCartData .= " <td align=\"Right\" bgcolor=\"#FFFF99\">€ " . number_format(${$XCName}["contents"][8][$jRow], 2, ',', '.') . "</td>\n";
$XCartData .= " </tr>\n";
// set footer
$XC_footer = " <tr>\n <td colspan=\"4\" align=\"right\"><b> SubTotal </b></td>\n <td align=\"right\" bgcolor=\"#FFFF99\"><b> € " . number_format($XCart_sumTotal, 2, ',', '.') . "</b></td>\n </tr>\n";
$XC_footer .= " <tr>\n <td colspan=\"4\" align=\"right\"> Shipping </td>\n <td align=\"right\" bgcolor=\"#FFFF99\"> € " . number_format($XC_Shipping, 2, ',', '.') . "</td>\n </tr>\n";
$XC_footer .= " <tr>\n <td colspan=\"4\" align=\"right\"> </td>\n <td align=\"right\" bgcolor=\"#FFFF99\"> </td>\n </tr>\n";
$XC_footer .= " <tr>\n <td colspan=\"4\" align=\"right\"> Sales Tax </td>\n <td align=\"right\" bgcolor=\"#FFFF99\"> € " . number_format($XC_SalesTax, 2, ',', '.') . "</td>\n </tr>\n";
$XC_footer .= " <tr>\n <td colspan=\"4\" align=\"right\"><b> Grand Total </b></td>\n <td align=\"right\" bgcolor=\"#FFFF99\"><b> € " . number_format($XC_GranTotal, 2, ',', '.') . "</b></td>\n </tr>\n";
$XC_footer .= " <tr>\n <td colspan=\"5\"> </td>\n </tr>\n";
$XC_footer .= "</table>\n </td>\n </tr>\n</table>\n";
// join all
if (isset($_SESSION["XC_CartMail"])) session_unregister("XC_CartMail");
$XC_CartMail = $XC_header . $XCartData . $XC_footer;
$_SESSION["XC_CartMail"] = $XC_CartMail;
session_register("XC_CartMail");
// *** Save XCart contents to table ***
require_once('XCInc/XCsaveAction.inc');
if (isset($_GET['XC_SaveCartToTable']) && ($_GET['XC_SaveCartToTable'] == "1")) {
$XC_destColName = array("ProductID","Quantity","","Color","UnitPrice","","Discount","","Total");
$XC_destColType = array("str","num","str","str","num","num","num","num","num");
$XC_orderId = $_SESSION['OrderID'];
$XC_tableName = "wibble_orderdetails";
$XC_OrderIDCol = "OrderID";
$XC_OrderIDType = "num";
$XC_AddToTableRedirect = "thanks.php";
$XC_conName = "wibbles";
require_once('XCInc/SaveXCartToTable.inc');
// clone a session
if (!session_id()) session_start();
if (isset($_SESSION["OrderNum"])) session_unregister("OrderNum");
if (isset($_SESSION["OrderID"])) {
$OrderNum = $_SESSION["OrderID"];
$_SESSION["OrderNum"] = $OrderNum;
session_register("OrderNum");
function DoFormatCurrency($theObject,$NumDigitsAfterDecimal,$DecimalSeparator,$GroupDigits,$Curren cySymbol) {
$currencyFormat=$CurrencySymbol.number_format($theObject,$NumDigitsAfterDecimal,$Dec imalSeparator,$GroupDigits);
return ($currencyFormat);
function DoFormatPercent($theObject,$NumDigitsAfterDecimal,$DecimalSeparator,$GroupDigits) {
$currencyFormat=number_format($theObject*100,$NumDigitsAfterDecimal,$DecimalSeparato r,$GroupDigits).'%';
return ($currencyFormat);
?>
Maybe you are looking for
-
4s with ios8 - battery drain issue - possible clue?
I am one of the 4s users who is experiencing significantly accelerated battery drain since upgrading to ios 8.0 the first day it was released. My battery will drain from %100 to less than %50 in less than two hours with typical light use. Previousl
-
Flash player not working after recent software update
I have a MAC OSX 10.5.8, after the recent software update my flash player no longer works. I have read that there is a problem with security for the version of flash that I was using and this is the reason it was disabled. However, I have tried to do
-
A way to have the new ipad automatically connect to Wi-Fi or AT&T?
Is there a way to have the new ipad automatically connect to Wi-Fi or AT&T depending on what is available? For instance, I have the new ipad connected to the wi-fi in my office. While driving to work I connect using the AT&T network. When I walk i
-
ITunes won't run after downloaded.
I downloaded iTunes to Windows XP successfully, but it won't run when I attempt to open it. Nothing happens. My iPod should arrive in a week and I want to have iTunes prepared to transfer songs ASAP! Why won't iTunes open after I've successfully down
-
Airport Utility 6.3.1 does not recognize Airport Extreme 7.6.4
Running OS 10.8.5. Message "This version of AirPort Utility doesn't support this base station. Go to AirPort Service...for more info" pops up. My wireless internet networks are fine but I am trying to network a printer and a few other mobile devices