SQL query doesn't work in VB program
Hi:
The following SQL query doesn't work into a VB program, I'm using Oracle OLEDB to established connection to the DB, ... the query returns 0 rows ...
When I run this same query from any SQL Plus, works well (returning me something like 119 rows) ...
Any clue or hint ??
Thanks in advanced
Angel Castro
SELECT OPERADOR, ID_ALIMENTADOR, RB_FSC, NUM_CTROL, COND_OPERA, TRANSITORIO, PENDIENTES, ANORMAL, EDO_REAL, IDENTIFICADOR, CAUSA
FROM HISTORICO_OPERACION
WHERE (FECHA BETWEEN '20-AUG-2004' AND '5-NOV-2004')
AND (HORA BETWEEN '10:00:00' AND '16:00:00')
ORDER BY ID_ALIMENTADOR ASC;
Is the column FECHA of datatype DATE?
Are you running the query with the constant date looking like strings ('20-AUG-2004' in your post, for example) as-is from the VB program?
If not, are you binding the parameters correctly?
What is the setting of your NLS_DATE_FORMAT parameter?
What happens if you do a
ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY'from your VB program before running the query?
Similar Messages
-
Form on a SQL Query - doesn't work with SELECT * - bug or feature ?
When I do this,
Create Page -> Page with Component -> Form -> Form on a SQL Query -> SELECT * FROM EMP
I do not get any items displayed and it creates a simple HTML region / page. Do we have to necessarily specify the column names ?
Iam looking at a way to see if any addition of columns in the table does not involve IT intervention in recreating the form.
When we try to create with Form on a SQL Query, then shouldn't it be similar to the Report where the same thing works, if I give SELECT function_returning_columns() from DUAL even then the same thing happens where it creates an ITEM called functions_returning_columns() it creates HTML region
I asked a related question with no answer :-( in
Dynamic Creation of Items in Runtime through Application UIHi Marc,
Thanks. I just tried something like this. Taking the EMP table example, (it doesn't matter which table), I created a region based on a Pl/Sql function returning SQL query
( I selected the vertical report template including nulls to display it like a form ) :
DECLARE
v_sql VARCHAR2(3000) ;
mn_idx NUMBER := 1 ;
BEGIN
v_sql := 'SELECT ' ;
FOR recs IN (SELECT * FROM ALL_TAB_COLUMNS WHERE TABLE_NAME = 'EMP' ORDER BY COLUMN_ID)
LOOP
v_sql := v_sql || 'HTMLDB_ITEM.TEXT(' || mn_idx || ',' ||
recs.column_name || ') ' || recs.column_name || ', ' ;
mn_idx := mn_idx + 1 ;
END LOOP ;
v_sql := SUBSTR(v_sql, 1, LENGTH(v_sql) -2) ;
v_sql := v_sql || ' FROM EMP WHERE EMPNO = 7369 ORDER BY 1 ' ;
RETURN v_sql ;
END ;
This allowed me to do my updates etc.., Then I created a button called 'Apply' and a process called 'update_changes' on button click and defined this:
DECLARE
v_sql varchar2(1000) ;
mn_ctr NUMBER := 1 ;
BEGIN
v_sql := 'BEGIN UPDATE EMP SET ' ;
FOR recs IN (select COLUMN_ID, COLUMN_NAME, DATA_TYPE
from all_tab_columns where table_name = 'EMP'
ORDER BY COLUMN_ID) loop
-- Make changes here if required- this is assuming 9 columns --
v_sql := v_sql || recs.column_name || ' = HTMLDB_APPLICATION.G_F0' || mn_ctr || '(1),' ;
mn_ctr := mn_ctr + 1;
end loop ;
v_sql := substr(v_sql, 1, length(v_sql) - 1) ;
v_sql := v_sql || ' WHERE EMPNO = 7369; END ;' ;
execute immediate (v_sql) ;
END ;
Since this is for example, I didn't include code for Checksum and hardcoded empno = condition and have provision for 9 columns. I made some changes and tried saving it and I was able to do it.
I altered the table to add a column / drop a column and when I relogin, Iam able to see the changes.
Can you tell me if there could be any drawbacks in this approach ?. -
SQL Query doesn't work coccrectly
The table includes list of month and years.
When I write
SELECT MONTH,YEAR FROM MONTH_DETAILS ORDER BY YEAR DESC,MONTH DESC;
it works correcty and returns
MONTH YEAR
7 2009
6 2009
5 2009
4 2009
3 2009
2 2009
1 2009
12 2008
11 2008
But when I want to return only the first one(month=7 and year=2009) and change query like this
SELECT MONTH,YEAR FROM MONTH_DETAILS WHERE ROWNUM=1 ORDER BY YEAR DESC,MONTH DESC;
it returns
MONTH YEAR
2 2009
what is the problem?
Both month and year fields are defined as numbers.Your query should be
SELECT MONTH
,YEAR
FROM (
SELECT MONTH
,YEAR
,ROWNUM row_num
FROM MONTH_DETAILS
WHERE ORDER BY YEAR DESC,MONTH DESC
WHERE row_num = 1; Regards
Arun -
SQL Query (PL/SQL Function Body returning SQL query) doesn't return any row
I have a region with the following type:
SQL Query (PL/SQL Function Body returning SQL query).
In a search screen the users can enter different numbers, separated by an ENTER.
I want to check these numbers by replacing the ENTER, which is CHR(13) || CHR(10) I believe, with commas. And then I can use it like this: POD IN (<<text>>).
It's something like this:
If (:P30_POD Is Not Null) Then
v_where := v_where || v_condition || 'POD IN (''''''''||REPLACE(''' || :P30_POD || ''', CHR(13) || CHR(10), '','')||'''''''''')';
v_condition := ' AND ';
End If;
But the query doesn't return any rows.
I tried to reproduce it in Toad:
select * from asx_worklistitem
where
POD IN (''''||REPLACE('541449200000171813'||CHR(13) || CHR(10)||'541449206006341366', CHR(13) || CHR(10), ''',''')||'''')
==> This is the query that does't return any rows
select (''''||REPLACE('541449200000171813'||CHR(13) || CHR(10)||'541449206006341366', CHR(13) || CHR(10), ''',''')||'''')
from dual;
==> This returns '541449200000171813','541449206006341366'
select * from asx_worklistitem
where pod in ('541449200000171813','541449206006341366');
==> and when I copy/paste this in the above query, it does return my rows.
So why does my first query doesn't work?
Doe anyone have any idea?
Kind regards,
Geert
Message was edited by:
ZorryThanks for the help.
I made it work, but via the following code:
If (:P30_POD Is Not Null) Then
v_pods := REPLACE(:P30_POD, CHR(13) || CHR(10));
v_where := v_where || v_condition || 'POD IN (';
v_counter := 1;
WHILE (v_counter < LENGTH(v_pods)) LOOP
v_pod := SUBSTR(v_pods, v_counter, 18);
IF (v_counter <> 1) THEN
v_where := v_where || ',';
END IF;
v_where := v_where || '''' || v_pod || '''';
v_counter := v_counter + 18;
END LOOP;
v_where := v_where || ')';
v_condition := ' AND ';
End If;But now I want to make an update of all the records that correspond to this search criteria. I can give in a status via a dropdownlist and that I want to update all the records that correspond to one of these POD's with that status.
For a region you can build an SQL query via PL/SQL, but for a process you only have a PL/SQL block. Is the only way to update all these records by making a loop and make an update for every POD that is specified.
Because I think this will have a lot of overhead.
I would like to make something like a multi row update in an updateable report, but I want to specify the status from somewhere else. Is this possible? -
Buckup SQL Script doesn't work
Hi all,
In ECC i want schedule ASE jobs to dump transaction logs,i do it fellow the note 1588316 step by step . In schedule jobs my sql script doesn't work,but it works in sql command line.
sql script :
dump transaction DEV using config= 'DEVLOG'
Anybody can give me some advise to face this issue? Thanks in advance.
David LvHi all,
My problem sloved, it's JSagent problem.
sp_dumptrans not working at dbacockpit @Alcino Melo
use sybmgmtdb
go
sp_js_wakeup "start_js",1
go
after start JSagent my sql script can run
Thanks all
David Lv -
"Speech" doesn't work for Adobe program?
It works well for "get my mail,""empty the trash," etc. But "hide this application" doesn't work in Adobe programs like Photoshop, and Illustrator. Is it supposed to not work?
What was it?
-
Hi kind people!
I have udf TEST on the picture. The query on the picture I have connected to the field Test and conected to field description too. But with the field Description the query doesn't work. U_Producer is the name of another field. Why does not it work?Hi Gordon!
From the right I have UDF for choosing the spare parts of auto. I want to add a spare part, for example to item master data (OITM). I enter every field step by step 1 - 4 by choosing frome use tables linked in every field. I choose fielf 1 (Brand) for example TOYOTA and in the use table of 2(Model) field i see only values that belong to TOYOTA that to say corolla, carina, vista and so on. But to find any component exactly i put on the loupe in the field 5 and see a table where all types of auto parts in the world but they are filtered with parametrs in 1-4 fields. I chhose needed component and get in the 5 field any code of a choosed part. Then i d liked to link the table of filed 5 to field Description too and to filter component with code in field 5 in order to get item description from the use table. I used the one method of filtering in all fields Here i see that i can to filter values using use fields but I don't use it in standart field description, although the usual selection of elements of any use table works. As a result a see that the problem that doesn't work the selection and filtration in the field description but it works in in UDF. -
Hello everybody,
I want to enter a word in a table if that word does not already exist in the table.
I wrote a query like this.
String word="Football";
sql="INSERT INTO m_word_list (word_text , category_id , used_counter, date_of_addition, added_by, is_status ) VALUES ('"+word+"', 2, 0, '"+todaysDate+"', '1', '1')WHERE '"+word+"' NOT IN
(SELECT * FROM `m_word_list` WHERE word_text = '"+word+"');
Where am I wrong in the query?
Please help.1.) Always post the exception, error message and whatever detail you've got when something "doesn't" work.
2.) Always use PreparedStatements to execute parameterized queries/updates instead of dynamically building the String
3.) INSERT INTO doesn't have a where clause.
Why don't you simply make the wort_text column unique and simply try to insert. If there's already such a word then you'll get a message which tells you. -
Where rownum=2 in my sql query is not working . Why ??
Hello,
i am using Oracle 11g .Referring scott schema's emp table.
I just issued this sql query with the intention to get second highest salary of a employee. But i am unable to understand why my query fails ?
select rownum,empno,ename,sal from (select empno,ename,sal from emp order by sal desc) where rownum=2;This query is returning no rows . Can you tell why this query is returning no rows ?888953 wrote:
Because you can use ROWNUM only to limit the number of returned records, not to return a specific record.
So only this has sense (n any number):
ROWNUM <= n
or
ROWNUM = 1 (which is equal to ROWNUM <= 1)
Anything else will not return a row.As i said ,
select * from (select rownum rn,empno,ename,sal from (select empno,ename,sal from emp order by sal desc)) where rn=2;this query is working fine.So rownm can be used to return a specific record . Please rectify me if i am wrong . -
Hi,
I have a region as the type
"SQL Query (PL/SQL function body returning SQL query)".
The query works fine for reports if I query two columns. Select 1, 2 from table.
For some reason if the returning query has more than three columns (select 1, 2, 3 from table), I get an error:
"report error:
ORA-01403: no data found"
Any help would be great. Thanks.Hi,
I've been trying all sorts of things on a test report and the only way that I get extra columns is by including derived columns in the report. Otherwise, even with custom headings, adding or removing columns in the report's PL/SQL adjusts the columns as I would expect.
Are your extra columns derived or can your report return a varying number of columns?
Andy -
How to know which sql query is taking time for concurrent program
Hi sir,
I am running concurrent program,that is taking time to execute ,i want to know which sql query causing performance
Thanaks,
SreekanthHi,
My Learning: Diagnosing Oracle Applications Concurrent Programmes - 11i/R12
How to run a Trace for a Concurrent Program? (Doc ID 415640.1)
FAQ: Common Tracing Techniques in Oracle E-Business Applications 11i and R12 (Doc ID 296559.1)
How To Get Level 12 Trace And FND Debug File For Concurrent Programs (Doc ID 726039.1)
How To Trace a Concurrent Request And Generate TKPROF File (Doc ID 453527.1)
Regards
Yoonas -
Multiple conditions in Query doesn't work
Hi all,
I've made a query pointing on a Multiprovider wich 's made of two main dimension ( multiple infoproviders ) :
contract and pricing and on the other hand Sales and Revenues.
In my Query, one condition's concerned by a contract & pricing key figures ( Number of pricing condition > 0 ), and another one is about a Minimum Turnover Sales & Revenues key Figures restriction( by a prompt ).
This doesn't match, Some rows are missing, and while a condition is active , the other one can't be..
If any one meet this kind of problem before ?
Thanks and sorry for my bad english..Hi,
I already try to create another key figure wich made like this :
Number of condition * Turnover
and made a condition on this result.
But the main problem is if the contract doesn't have Turnover, it will not shown the rows with condition ..( the condition is on the single value 'number of document ) and if I put anotehr condition with number of condition > 0, it still doesn't work..
thanks for help. -
SQL / XML doesn't work here
Hi,
I'm working on Oracle9i Enterprise Edition Release 9.2.0.5.0.
and with SQLPLUS i try this :
SELECT XMLFOREST(1 "test", 2 "test2") from dual;
But it seems taht it doesn't work I jsut have this result without error :
XMLFOREST(1"TEST",2"TEST2")
Has Someone an idea ?
thanks.
Romeo.SQL*Plus: Release 10.2.0.1.0 - Production on Wed Dec 7 07:25:53 2005
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> SELECT XMLFOREST(1 "test", 2 "test2") from dual;
XMLFOREST(1"TEST",2"TEST2")
<test>1</test><test2>2</test2>
SQL>
Um... which release of SQL*PLUS are you using to get your result...
Can you try
SELECT XMLFOREST(1 "test", 2 "test2").getClobVal() from dual; -
SQL batch doesn't work; How to fetch related objects with fetch group?
I have two questions:
1. SQL Batch doesn't seem to work. I have tested some batch object creation
with BatchLimit set to -1, 0, 1, 25, 100. They all have similar
performance.
kodo.jdbc.DBDictionary: BatchLimit=25
2. How to use custom fetch group to fetch related objects? The example of
custom fetch group only show how to fetch different attributes in different
groups. I have a test cases where I would like to pre-fetch related objects
to save round trip.
Enviroments:
* Kodo 3.1.0 RC1
* Oracle 9i release 1
Thanks for any help!
Qingshan Luo
Senior Software Engineer
Open Harbor
1123 Industrial Road
San Carlos, CA 94070
Phone: 650-413-4251
Fax: 650-413-4298try poracle 10g driver. At least they fixed terrible CLOB bug may be batch
to. BTW 9.2.x has problem with batching with deferred constraints so be
careful
"Greg Campbell" <[email protected]> wrote in message
news:c3dmnu$rmj$[email protected]..
>
"Qingshan Luo" <[email protected]> wrote in message
news:c3dg7q$mdl$[email protected]..
Hi,
I have two technical questions with Kodo.
1. SQL Batch doesn't seem to work. I have tried batch size of -1, 0, 1,25.
But the performance from batch creating objects is not affected by batch
size.
kodo.jdbc.DBDictionary: BatchLimit=25You may be running into a bug in the Oracle 9.2 driver. That driverdoesn't
reliably give update counts when using batching and prepared statement
caching. By default, Kodo will turn off batching. You can manuallyenable
batching by setting the BatchLimit on your DBDictionary, as you've done.If
you do this, though, you may want to turn off prepared statement cachingby
setting MaxCachedStatements to 0 (see
http://www.solarmetric.com/Software/Documentation/3.1.0RC1/docs/ref_guide_dbsetup.html#ref_guide_dbsetup_builtin).
>
2. How to use custom fetch groups to eagerly fetch related persistable
objects? Example only showed attributes, not relationships.You can find information on setting up eager fetching of relations at
http://www.solarmetric.com/Software/Documentation/3.0.3/docs/ref_guide_
perfpack_eager.html
Basically, you'll need to add the relations to your fetch group, and
set the eager fetching mode.
Enviroment:
* Kodo 3.1.0 RC1
* Oracle 9i release 1.
Qingshan Luo
Senior Software Engineer
Open Harbor
1123 Industrial Road
San Carlos, CA 94070
Phone: 650-413-4251
Fax: 650-413-4298 -
I've instaled an oracle lite8i version 4.0.0.2.0 on Windows 98 operation system.
When i try to change something in polite DB, the sql commands doesn't cause any effect on the polite.
For example :
when i type "alter user system identified by asd", even connected as system, i receive the message "Operation 0 succeeded", but the password doesn't change.
This also happen with "create user ... " "create table ... "
What should i do ????
Thanks"/" does work . Please give a full working example that doesn't work.
In Home>SQL>SQL Commands you usually execute a single command.
But you can write multiple commands like:
create table xx1(n number)
drop table xx1
/To execute one after the other, just highlight the first
create table xx1(n number)
/and press <ctrl>+<enter> .
Then highlight the next command and press <ctrl>+<enter> again.
--- OR ---
create a sql script in Home>SQL>SQL Scripts . Then you can execute multiple commands at once.
~Dietmar.
Maybe you are looking for
-
Error: Max no of items in FI reached
Dear Gurus, As per our requirement we have generated a sales order and invoice with 1300 line items(single order with 1300 items), for all the items accounting docs were not generated, when i am trying to release the invoice to accounting the error w
-
Powerbook G4 to watermarking software
Does anyone know of any software I run on a powerbook G4 to watermark paintings Regards Byron
-
Photoshop Elements 3.0 Back-Up - File Name Change
I currently run Photoshop Elements 3.0. When I back-up the catalog from within Photoshop, the file names are changed (i.e 100_2424.JPG to BO00012). All of my Premiere Elements 7 projects point to the original file name. If I ever lost that original J
-
Why is a Screenshot a different color when dropped back in to iWeb in Safar
First post ever, new to iWeb. I took screenshot of an image and dropped the screenshot PNG back into my iweb pages. It blends correctly with the background color in IE (on a Vista PC) and Firefox on both Mac and PC but the color has shifted significa
-
Server error in communication when trying to submit a formscentral form?
What does it mean when one of my form users gets a "server error in communication" when trying to submit a form. The saving function worked just fine. Help this is my first form! Thanks!