Function Call returning old SQL Query
Hello All,
I have a Pipeline Function which creates a SQL within (Dynamic SQL that gets stored in a LONG variable) based on the parameter STRING passed to the function. Inside this function, once the SQL is built, I am inserting this SQL into a log table, for logging purpose.
Note: my function has only one parameter which is a string. This string accepts a name:value pairs with a delimiter which I breakdown inside the function. But this functionality is working fine.
Issue:
When I run the function with parameter with a STRING say (Age = 20, Gender = M) for the first time, it works.
<code>SELECT * FROM TABLE (
PIPE_FUN_SEARCH_PKG.get_search_records ('EMP_AGE:20|EMP_GENDER:M'));
</code>
When I change the parameters to (Age = 20, Gender = F), it gives me the results of the earlier function call.
<code>SELECT * FROM TABLE (
PIPE_FUN_SEARCH_PKG.get_search_records ('EMP_AGE:20|EMP_GENDER:F'));
</code>
When I open the logs, I see the SQL being built is the earlier one.
As a test I closed the session and ran (Age = 20, Gender = F) first. It works fine. When I run a different parameter string, it always mimics the earlier function call.
Is CACHING in play here. I tried both the following:
<code> dbms_result_cache.bypass(FALSE);
dbms_result_cache.flush;
</code>
I tried multiple tests, with different parameters and only the first one runs fine and second one copied the earlier. However, when I open two sessions on two different windows it doesn't happen.
Also, in the Logging table I am capturing the input string as a confirmation, which is coming correctly. But the SQL being build mimics the earlier call.
I tried to set the variable which hold the SQL Statement to empty (v_sql := '';) at the beginning and also at the end. Still no use.
Kindly help if I am over looking anything.
Regards,
Aj
Aj09 wrote:
I have a Pipeline Function which creates a SQL within (Dynamic SQL that gets stored in a LONG variable) based on the parameter STRING passed to the function. The LONG data type has been replaced by the LOB data type. Oracle specifically recommends not using the old LONG data type.
Issue:
When I run the function with parameter with a STRING say (Age = 20, Gender = M) for the first time, it works.
<code>SELECT * FROM TABLE (
PIPE_FUN_SEARCH_PKG.get_search_records ('EMP_AGE:20|EMP_GENDER:M'));
</code>
When I change the parameters to (Age = 20, Gender = F), it gives me the results of the earlier function call.
<code>SELECT * FROM TABLE (
PIPE_FUN_SEARCH_PKG.get_search_records ('EMP_AGE:20|EMP_GENDER:F'));
</code>The tag is ** - not *<code>*.
Why a pipeline function? Why dynamic SQL? Are you using +DBMS_SQL+ to create the dynamic cursor? If not, why not? Only +DBMS_SQL+ allows dynamic binding in PL/SQL. Without that, your code will burn a lot of additional CPU on hard parsing and trash and fragment Shared Pool memory.
When I open the logs, I see the SQL being built is the earlier one.
How do you record the current SQL? Are you using a static variable to capture the SQL statement generated?
From what you have described - this is yet another horribly flawed approach in all respects. To data modelling. To relational databases. To Oracle. To SQL.
Reinventing the SQL language for data retrieval as a pipeline function using a funky parameter interface - sorry, I just don't get that. It is an insane approach.
Similar Messages
-
Analyze: PL/SQL function body returning an SQL query
I need to obtain the final SQL returned by the PL/SQL function.
I will be using this final SQL in a procedure.
Please provide some advise on how to obtain the SQL. I have already looked in the DBMS_SQL package but I am not sure if that is the right place to look into.
Regards,
SumitI am trying to modify the export_to_excel package from Denes kubicek to provide me an excel from PL/SQL function body returning an SQL query.
Here is the simplified PLSQL code in the region source.
declare
l2 varchar2(2000) null;
begin
l2:= 'Select NAME,ORIGINATED,OWNER,ORIGINATOR,';
l2:= l2 || 'DESIGNATED_UNIT,SOURCE,';
l2:= l2 || 'REFERENCE';
l2:= l2 || ' from MV_DETAILED_DATA';
return l2;
end;
I would like to get the SQL returned from this PLSQL and use it in a procedure to get the Excel.
As you mentioned earlier "copy the generated query string into an application item". [ +In the PL/SQL function body returning an SQL query, copy the generated query string into an application item. The app item value can then be passed as a parameter value to the procedure+ ]
I do not know how to dynamically excute this PLSQL in the region source and obtain the returned value in my procedure.
Best Regard,
Sumit. -
UDPWrite in a loop. "A Windows Sockets function call returned an unexpected error."
Hello together,
i use UDP Support Library in NI CVI 9.0. When i wait for receiving a packet at the pc to send then a packet from the pc, the functions UDPRead and UDPWrite work fine. If i want to test the maximum throughput, i put the UDPWrite in a loop, but then an error occurs. It is "kUDP_UnexpectedWinsockError"
Error Popup:
"NON-FATAL RUN-TIME ERROR: "main.c", line 53, col 22, thread id
0x00000C18: Library function error (return value == -6822
[0xffffe55a]). A Windows Sockets function call returned an unexpected
error."
Line 53:
status = UDPWrite (channel, 60100, "192.168.1.10", pOutputBuffer, 1458);
the whole loop:
while(1)
status = UDPWrite (channel, 60100, "192.168.1.10", pOutputBuffer, 1458);
counter++;
if(counter>50)
break;
else{;}
The error occurs after 3-16 packets have been sent. If i step through the programm, no error occurs. So i guess its because the UDPWrite command is invoked too fast. pOutputBuffer has static data. I could use a delay in the loop, but then i dont know how to configure for maximal throughput.
Any ideas how to avoid this error?
Regards FlorianHello and thank you for your answer. Sorry that i reply a month later.
I dont know what you mean by "let 'er rip approach". Do you mean something like:
status = UDPWrite (channel, 60100, "192.168.1.10", pOutputBuffer, 1458);
if(status==0)
counter++;
else
Delay(0.00005);
I did not yet try to put the packet number in the payload, but there is just a 30 cm crossover cable between the two devices, no switch, no router. So the sequence should not be interruptet. And even if they arrive in chaos, i dont mind.
I have contacted the NI support 2 weeks ago, but no response yet.
I did some tests with a delay between the execution of UDPWrite(). The code:
float time = 0.0;
for(i = 1; i < 1000; i++)
status = UDPWrite (channel, 60100, "192.168.1.10", pOutputBuffer, 1458);
time = 1.0 / i;
Delay(time);
The results:
For i between 1 and 1000: no error, the speed of the last ten packets was about 6.5 MBit/s
For i between 1000 and 2000: error occured at i = 1585 (variable time in Delay was 0.0006313), the speed of the last ten packets was about 8 MBit/s
Then i put some constant values in Delay and ran 100 UDPWrite iterations:
Delay(0.0006): 7.48 MBit/s
Delay(0.0001): 10.7 MBit/s
Delay(0.00001): error occured at i=31, speed of 31 packets was 12.0 MBit/s
Delay(0.00008): 100 of 100 packets, speed 10.9 MBit/s
Delay(0.00005): error at i=41, speed of 41 packets 11.1 MBit/s -
SLDCHECH: Function call returned exception code 3
Hi all.
I am trying to set up ESS and MSS on EP 6.0 SP15.
I have configured the RFC destination, and when i do a test in RZ70 and SM59 everything is ok, but when i try running transaction SLDCHECK i get the following error:
Use transaction SLDAPICUST if you wish to maintain the SLD server access data
Launching the SLD GUI in a separate browser window...
=> Verify in the browser GUI that the SLD is in a healthy running state!
Calling function LCR_LIST_BUSINESS_SYSTEMS
Retrieving data from the SLD server...
Function call returned exception code 3
=> Check whether the SLD is running!
Summary: Connection to SLD does not work
=> Check SLD function and configurations
Can anybody shead some light on this problem?
Regards LiselotteDear Liselotte,
This will help you,
http://help.sap.com/saphelp_nw04/helpdata/en/78/20244134a56532e10000000a1550b0/frameset.htm
Might be Java version to the proxy settings. Try to go thru listed down various troubleshooting steps in following this weblog.
Unable to open IR/ESR/ID ? (XI/PI/PI 7.1) [Updated for PI 7.1 support]
Regards
Agasthuri Doss -
Avoid procedure or function calls between a SQL operation and an implicit cursor test
when i analyse this code with code expert
atpidgeon wrote:
when i analyse this code with code expert
UPDATE P_PM_CONTROL_COUNT
SET AVAIL_SEG = AVAIL_SEG -1,
ALLOCATION = ALLOCATION -1
WHERE PM_UNIT_TYPE_ID = vrectab(1)
AND USAGE_DATE = vrectab(2)
AND SEGMENT_CODE = vrectab(5)
AND ALLOCATION - UNITS_RESERVED > 0;
IF sql%rowcount = 0 then --Added block and exception to prevent invetory going negative when placing multi units in same unit type out of service.
vErrMsg := 'Could not process your out of service request because your selection for unit '|| vrectab(3) || ' at ' || pvPropertyId || ' for ' || vrectab(2) || ' would cause segment ' || vrectab(5) || ' to be over allocated.';
RAISE SegOverAllocated;
END IF;
i get "Avoid procedure or function calls between a SQL operation and an implicit cursor test.",as far has i know
iff you're doing a sql%rowcount after an update.. trying to see how many rows were updated... you dont want procedure or function calls between the update and the sql% line
correct me if im wrong and how would i fix it?or maybe i shouldnt
You correct it by NOT executing function calls as part of the UPDATE statement.
1. Issue the function calls BEFORE the update statement
2. save the function results into variables
3. use those variables in the UPDATE statement.
v_rectab1 := vrectab(1);
v_rectab2 := vrectab(21);
v_rectab5 := vrectab(5);
UPDATE P_PM_CONTROL_COUNT
SET AVAIL_SEG = AVAIL_SEG -1,
ALLOCATION = ALLOCATION -1
WHERE PM_UNIT_TYPE_ID = v_rectab1
AND USAGE_DATE = v_rectab2
AND SEGMENT_CODE = v_rectab5
AND ALLOCATION - UNITS_RESERVED > 0; -
PL/SQL function returning a SQL Query
Is this only availabe in HTML db or in 10g in general? Where do I find more about this feature?
Thanks in advance,
DenesNot sure what you mean. HTML DB allows to use a PL/SQL function returning a valid SQL query in report regions.
Its just a PL/SQL function returning a string, outside of HTML DB, I guess you can use it wherever it makes sense. -
PLSQL function body returning an sql report returns ORA-01403 No Data Found
I am on APEX 3.1.2.00.02 and Oracle 10g.
I am developing a report with SQL Query (PL/SQL function body returning SQL query) type. But on running the report I am getting
report error:
ORA-01403: no data found
Region Source
declare
qry varchar2(32767);
begin
--Procedure call
my_pkg.get_query(qry);
htp.p(qry);
return /*select 1 from dual */ qry;
end;
Procedure
PROCEDURE get_query (V_QRY OUT VARCHAR2)
IS
qry varchar2(32767);
begin
qry := ' select name
, max(decode(to_char(service_date,''Mon-YY''), ''Jan-09'', value, null)) as "Jan-09"
, max(decode(to_char(service_date,''Mon-YY''), ''Jan-09'', value, null)) as "Feb-09"
from MY_TABLE
group by name ';
V_QRY := qry;
end;
The query will be enhanced later to add more months and year based on user parameters once I am successfull in running report on this.
I wish to use Query Specific Column names. I have seen this suggestion from Scott in a number of threads to use /*select 1 from dual */ with query but not working in my case.
Can someone please suggest what can I do to make it working?
Regards,
AmirFirstly, have you unit tested the procedure (namely, within the SQL Workshop, SQL*Plus, SQL Developer,etc, etc.) to see if it produces the right output in the first place?
If you have, and the query string generated is valid, try assigning the output to a page item (thus allowing you to view it in the session browser) or even pass the procedure output into the debug window (with the use of the wwv_flow.debug function). This might reveal some state or session change which is causing it not to return.You might find this easier to achieve if you change from a 'procedure and out parameter' combination to a 'function returning string' approach.
Alternatively, try re-creating the report in a new region - occasionally I've come across weird bugs with report regions which resolved themselves in this manner. -
How do I query off a pl/sql funtion that returns an sql query in apex.
I built a function that a returns a good sql query. I verified the out put of my function works when I manually entered into the SQL Commands.
Is it possible to build a report off of this query. My attempt failed with the following error.
failed to parse SQL query:
ORA-00933: SQL command not properly ended
I am sure the query generated is correct. Like I mentioned, I was able to use in the sql command succesfully.
Thanks,
Edited by: greich on Nov 21, 2008 10:55 AMThis is the code for my function:
create or replace function f_act_proj_sched (i_facility varchar2, i_date varchar2, i_shift varchar2)
Return varchar2 is
o_query Varchar2 (32000);
BEGIN
-- function that will return the query used in main application
o_query := o_query || 'SELECT act_proj.DESTINATION,';
o_query := o_query || ' act_proj.SHIPPING_DATE,';
o_query := o_query || ' act_proj.SHIFT,';
o_query := o_query || ' act_proj.JOB_CLASS_GROUPING,';
o_query := o_query || ' act_proj."Actual Units",';
o_query := o_query || ' act_proj."Projected Units",';
o_query := o_query || ' act_proj."Actual Hours",';
o_query := o_query || ' act_proj."Projected Hours",';
o_query := o_query || ' NVL (sched."Sched_Hours", 0)';
o_query := o_query || ' "Scheduled Hours"';
o_query := o_query || ' From (SELECT P.DESTINATION,';
o_query := o_query || ' P.SHIPPING_DATE,';
o_query := o_query || ' P.JOB_CLASS_GROUPING,';
o_query := o_query || ' P.SHIFT,';
o_query := o_query || ' NVL (FACILITY_STATS.WORK_UNITS, 0) "Actual Units",';
o_query := o_query || ' NVL (P.WORK_UNITS, 0) "Projected Units",';
o_query := o_query || ' NVL (CASE FACILITY_STATS.JOB_CLASS_GROUPING';
o_query := o_query || ' WHEN ''Backhaul''';
o_query := o_query || ' THEN Facility_stats.work_units';
o_query := o_query || ' / Goal_destination_shift.backhauler_goal';
o_query := o_query || ' WHEN ''Selector''';
o_query := o_query || ' THEN Facility_stats.work_units';
o_query := o_query || ' / Goal_destination_shift.selector_goal';
o_query := o_query || ' WHEN ''Common''';
o_query := o_query || ' THEN Facility_stats.work_units';
o_query := o_query || ' / Goal_destination_shift.backhauler_goal';
o_query := o_query || ' WHEN ''Lift''';
o_query := o_query || ' THEN Facility_stats.work_units';
o_query := o_query || ' / Goal_destination_shift.forklift_goal';
o_query := o_query || ' ELSE Facility_stats.work_units';
o_query := o_query || ' END, 0) "Actual Hours",';
o_query := o_query || ' CASE P.JOB_CLASS_GROUPING';
o_query := o_query || ' WHEN ''Backhaul''';
o_query := o_query || ' THEN P.work_units';
o_query := o_query || ' / Goal_destination_shift.backhauler_goal';
o_query := o_query || ' WHEN ''Selector''';
o_query := o_query || ' THEN P.work_units';
o_query := o_query || ' / Goal_destination_shift.selector_goal';
o_query := o_query || ' WHEN ''Common''';
o_query := o_query || ' THEN P.work_units';
o_query := o_query || ' / Goal_destination_shift.backhauler_goal';
o_query := o_query || ' WHEN ''Lift''';
o_query := o_query || ' THEN P.work_units' ;
o_query := o_query || ' / Goal_destination_shift.forklift_goal';
o_query := o_query || ' ELSE P.work_units';
o_query := o_query || ' END "Projected Hours"';
o_query := o_query || ' FROM STAFFING.FACILITY_STATS,';
o_query := o_query || ' STAFFING.FACILITY_STATS P,';
o_query := o_query || ' STAFFING.GOAL_DESTINATION_SHIFT';
o_query := o_query || ' WHERE (GOAL_DESTINATION_SHIFT.DESTINATION = P.DESTINATION)';
o_query := o_query || ' AND (GOAL_DESTINATION_SHIFT.SHIFT_FLAG = P.SHIFT)';
o_query := o_query || ' AND (FACILITY_STATS.DESTINATION(+) = P.DESTINATION)';
o_query := o_query || ' AND (FACILITY_STATS.SHIPPING_DATE(+) = P.SHIPPING_DATE)';
o_query := o_query || ' AND (FACILITY_STATS.JOB_CLASS_GROUPING(+) = P.JOB_CLASS_GROUPING)';
o_query := o_query || ' AND (FACILITY_STATS.SHIFT(+) = P.SHIFT)';
o_query := o_query || ' AND (P.PROJ_ACTUAL_FLAG = ''P'')';
o_query := o_query || ' AND (FACILITY_STATS.PROJ_ACTUAL_FLAG(+) = ''A'')';
o_query := o_query || ' AND P.DESTINATION = ' || i_facility;
o_query := o_query || ' AND P.SHIPPING_DATE = ' || i_date;
o_query := o_query || ' AND (case';
o_query := o_query || ' when to_number(' || i_shift || ') != -1';
o_query := o_query || ' Then P.SHIFT';
o_query := o_query || ' Else 1';
o_query := o_query || ' end =';
o_query := o_query || ' case';
o_query := o_query || ' when to_number(' || i_shift || ') != -1';
o_query := o_query || ' Then to_number(' || i_shift || ')';
o_query := o_query || ' Else 1';
o_query := o_query || ' end)) act_proj,';
o_query := o_query || ' (SELECT Destination,';
o_query := o_query || ' schedule_date,';
o_query := o_query || ' shift,';
o_query := o_query || ' job_class_grouping,';
o_query := o_query || ' SUM ("Sched_Hours") "Sched_Hours"';
o_query := o_query || ' FROM (';
-- Loop to create bucket query
for idx in 1..20 Loop
o_query := o_query || '(SELECT EMP_SCHEDULE.EMPLOYEE_ID,';
o_query := o_query || ' EMP_SCHEDULE.SCHEDULE_DATE,';
o_query := o_query || ' EMP_SCHEDULE.DESTINATION,';
o_query := o_query || ' EMP_SCHEDULE.SHIFT, ';
o_query := o_query || idx || ' "Bucket_number",';
o_query := o_query || ' Bucket' || idx || '_class "bucket class",';
o_query := o_query || ' JOB_CLASS_GROUPING,';
o_query := o_query || ' NVL (EMP_SCHEDULE.BUCKET' || idx || '_SCHED_HRS, 0) "Sched_Hours"';
o_query := o_query || ' FROM STAFFING.EMP_SCHEDULE,';
o_query := o_query || '(SELECT DISTINCT FACILITY_CLASS_BUCKET.JOB_CLASS_GROUPING,';
o_query := o_query || ' FACILITY_CLASS_BUCKET.DESTINATION';
o_query := o_query || ' FROM STAFFING.FACILITY_CLASS_BUCKET';
o_query := o_query || ' WHERE (FACILITY_CLASS_BUCKET.BUCKET_ID = ' || idx || ')) A';
o_query := o_query || ' Where A.Destination = EMP_SCHEDULE.DESTINATION';
o_query := o_query || ' and EMP_SCHEDULE.DESTINATION = ' || i_facility;
o_query := o_query || ' and EMP_SCHEDULE.SCHEDULE_DATE = ' || i_date;
o_query := o_query || ' AND (case';
o_query := o_query || ' when to_number(' || i_shift || ') != -1';
o_query := o_query || ' Then EMP_SCHEDULE.SHIFT';
o_query := o_query || ' Else 1';
o_query := o_query || ' end =';
o_query := o_query || ' case';
o_query := o_query || ' when to_number(' || i_shift || ') != -1';
o_query := o_query || ' Then to_number(' || i_shift || ')';
o_query := o_query || ' Else 1';
o_query := o_query || ' end))';
if idx < 20
THEN
o_query := o_query || ' UNION ';
Else
o_query := o_query || ')';
End if;
END Loop;
o_query := o_query || ' GROUP BY Destination,';
o_query := o_query || ' schedule_date,';
o_query := o_query || ' shift,';
o_query := o_query || ' job_class_grouping) Sched';
o_query := o_query || ' WHERE (act_proj.DESTINATION = sched.DESTINATION(+))';
o_query := o_query || ' AND (act_proj.SHIPPING_DATE = sched.SCHEDULE_DATE(+))';
o_query := o_query || ' AND (act_proj.SHIFT = sched.SHIFT(+))';
o_query := o_query || ' AND (act_proj.JOB_CLASS_GROUPING = sched.JOB_CLASS_GROUPING(+))';
o_query := o_query || ' ORDER BY SHIFT,';
o_query := o_query || ' job_class_grouping';
Return (o_query);
END; -
Function call returned in ref cursor
We have a ref cursor that calls a function in a package. When ODP.NET reads the cursor, it can't see what the function is returning. OO4O works fine, and if I take the sql that populates the ref cursor and put it into a temporary table, then select from that temporary table to return the ref cursor to ODP, it works fine. Anyone else seen this issue? Any help would be appreciated. Thanks.
Eric Schrauth
[email protected]Did you set the parameter direction to be ParameterDirection.Input when you created the parameter? Post your code.
-
Returning a SQL query result (resultset)
Hello,
I would like to return records from a SQL query but i can't return the resultset because the connection is already close.
How can i return the records from a query if it contain different types (int, string)?
I've been told to create another class which will hold the different variables and to return an instance of that class,
how can i do it?
Thanks,
Razwhat do you mean by "Whatsit"?
i have this code:
public class BestSeller {
...some functions...
public void SearchNAME (BestSeller DB, String table,String name) {
DB.connect();
try{
Statement stmt = con.createStatement();
resultSet = stmt.executeQuery("Select * from "+table+" where name like'"+name+"'");
//CachedRowSet rset = new CachedRowSet();
while (DB.resultSet.next()) {
System.out.println(DB.resultSet.getInt("ID")+" is "+DB.resultSet.getString("name")+", "+...+", "+DB.resultSet.getString("quantity")+", "+DB.resultSet.getString("delivery_time"));
stmt.close();
con.close();
catch (Exception err) {
System.out.println("ERROR: " + err);
}I didn't put the Connect function in here, but it works and i get the records printed to the screen.
I want to return all of the records (usually more then 1).
Can you tell me how can i implement your code to my case?
Thanks for the quick reply.
Edited by: raz27 on Aug 5, 2008 2:20 PM -
I have a process that runs a SQL query and returns the results as XML. When I test the query in the Process Properties tab in Workbench it appears to execute just fine. I can also test the XML information and see that the results are coming back correctly. But when I invoke the process I get an emtpy XML tag with no results. Recording the invocation and playing back the recording doesn't tell me anything useful. Has anyone ever seen this issue before? I don't understand why everything within the process seems to bring back results just fine but invoking it returns nothing.
Unfortunately I am not the admin for our LiveCycle instance and do not have access to the server logs (long story). I also am not authorized to share any LCA files for this project. Thanks though.
-
Return default data if no data is returned by sql query
Hi,
I have a requirement.
I have an inner query that returns no data. However I still want to return default data (say 'abc'). The below sql does not return anything inspite of using nvl . Please advise .
select nvl( x.vencode,'abc') vencode
from
-- below sql returns no data!
SELECT a.vencode vencode,
a.mid mid,
a.title title,
ROW_NUMBER() OVER (PARTITION BY a.vencode ORDER BY a.title) rnk
FROM (
SELECT *
FROM (SELECT vencode FROM vendor where login is not null and vencode = 'BKFI'
and login > (sysdate - 90) )
CROSS JOIN
(SELECT mid, title, ROWNUM num FROM tcommmemos where mid is not null)
) a,
(SELECT * FROM (
SELECT v.vencode, tc.mid, tc.title
FROM
(select * from vendor
where login is not null and vencode = 'BKFI'
and login > (sysdate - 90)) v,
tcommmemosviewed tcv, tcommmemos tc
WHERE v.vencode = tcv.vencode
and tc.mid is not null
--AND tc.post_date > v.hiredate
AND tc.mid = tcv.mid)
) b
where a.vencode = b.vencode(+)
and a.title = b.title(+)
and a.mid = b.mid(+)
and b.mid is null
) xUse any aggregate function it'll always return a value even if there no data in the table
create table r_dummy_1 (a number);
SQL> select * from r_dummy_1;
no rows selected
SQL> select nvl(max(a),1) from r_dummy_1;
NVL(MAX(A),1)
1 -
ADO and function that returns PL/SQL boolean datatype
How to get PL/SQL boolean datatype using ADO?
DBMS_SESSION.IS_SESSION_ALIVE function returns boolean.
This code raises error with very strange description:
Dim cmd As New ADODB.Command
str = "{? = call DBMS_SESSION.IS_SESSION_ALIVE(""000011112222"" )}"
With cmd
Set .ActiveConnection = objDB.Connection
.CommandText = str
.CommandType = adCmdText
.Parameters.Append .CreateParameter("Return", adBoolean, adParamOutput)
End With
cmd.Execute
? err.Source
OraOLEDB
? err.Number
-2147467259
? err.Description
4ûC
Thanks for any help.Mikhail,
OraOLEDB does not support PL/SQL boolean type.
Sinclair -
PL/SQL returning a Sql query in a report form
I am producing a simple form to display the number of non-conforming items produced per shift. I use some PL/SQL code to generate the appropriate start and end dates for the shift then build up a query to return.
I am having problems when I use a date mask (DD-MM-YYYY HH24:MI:SS), the :MI section of the date mask is seen as bound variables. If I restrict the time to HH24 without minutes or seconds, it works fine.
Does anyone have any thoughts on how to overcome this problem?This is the code I am using. As the shifts actually starts at 07:15 and 19:15, I need to add the minutes for it to be correct but they fail.
DECLARE
startDateStr VARCHAR2(25);
endDateStr VARCHAR2(25);
midniteStr VARCHAR2(25);
sqlQuery VARCHAR(1000);
BEGIN
-- Set up the start and end dates
startDateStr := to_char(sysdate, 'DD-MON-YYYY') || ' 07:15:00';
endDateStr := to_char(sysdate, 'DD-MON-YYYY') || ' 19:15:00';
midniteStr := to_char(sysdate, 'DD-MON-YYYY') || ' 00:00:01';
if (sysdate > to_date(startDateStr, 'DD-MON-YYYY HH24:MI:SS')
and sysdate < to_date(endDateStr, 'DD-MON-YYYY HH24:MI:SS'))
then
startDateStr := to_char(sysdate, 'DD-MON-YYYY') || ' 07';
endDateStr := to_char(sysdate, 'DD-MON-YYYY') || ' 19';
else
if (sysdate > to_date(midniteStr, 'DD-MON-YYYY HH24:MI:SS')
and sysdate < to_date(startDateStr, 'DD-MON-YYYY HH24:MI:SS'))
then
startDateStr := to_char(sysdate - 1,'DD-MON-YYYY') || ' 19';
endDateStr := to_char(sysdate, 'DD-MON-YYYY') || ' 07';
else
startDateStr := to_char(sysdate, 'DD-MON-YYYY') || ' 19';
endDateStr := to_char(sysdate+1, 'DD-MON-YYYY') || ' 07';
end if;
end if;
sqlQuery := 'select count(*), defectsource_s, disposition_s
from [email protected] ncr
where creationdate_t > to_date('
|| q'#'#' || startDateStr ||
q'#', 'DD-MON-YYYY HH24')
and creationdate_t <= to_date('#' || endDateStr ||
q'#', 'DD-MON-YYYY HH24')
and disposition_s in ('Scrap', 'Rework'#' ||
') group by defectsource_s, disposition_s
order by disposition_s, defectsource_s;' ;
return sqlQuery;
END; -
Javascript function call from PL/SQL block
Hello,
I am writing this pl/sql block that has checkbox and onselect, it calls javascript function.
I defined javascript function in page header, even though I get error that says function is not defined.
Please help.
Thank you,
H.I got it resolved...!!!
Maybe you are looking for
-
Oracle FLEXCUBE 12.0.4.0.0 certification
Is the Oracle FLEXCUBE Investor Servicing 12.0.4.0.0 certified to run on SLES 11 SP1+ systems? Where can I find a document that can confirm such certification? Is there a certification matrix for this product? I found in Oracle_FLEXCUBE_Investor Serv
-
LR3 and printer color is off.
I have a Epson CX7800 printer and when I try to print out my picture, the color is off. My image looks great, but when I try to print, the color's are not the same. I've gone to my printer settings and set them to no color management and set the d
-
On Win 7 64 bit, Firefox 7, 8 and Nightly all refuse to see Flash. I have uninstalled, installed Flash 11 several times.
-
Greetings to all! I'm very sorry, but i didn't have no other solution that ask for you help. I know this kind of problem has been discuss in many other posts, but this problem still exist, even after i tried all the actions posted in these messages.
-
During a video call i cannot see my caller but c...
during a skype video call my caller can see me but i cat see her. any idea what is causing this?