Databases general query
Ok so I have some free time on my hands at the moment and am once again looking into building more 'flexible' solutions where the client can update some parts of their websites themselves via a CMS.
A couple of queries:
1) A CMS requires a database to be efficient and effective? (I know some simple stuff can be changed via javascript but that's not what is required)
2) If so this is where I'm a bit concerned.
Lets take a simple example whereby I design a site (with an option of the client updating some sections). All is approved and uploaded to the remote server/database.
From that point on I have zero control over what the client changes in the CMS updatable sections of the website.
Some time later the host has a major problem and loses all the database updated information and concequently the site doesn't function correctly anymore or at least loses the updated information (if that's possible?)
That sounds a bit of a potential risk to me. Anyone else had a problem with lost database infromation once a site is live or see it as a risk?
Cheers
Os (Snowbound in Rochester UK)
Hi osgood
A good well designed cms system would also include a limited number of previous 'page' edits, (I normally save the last 5) or put another way the last 5 versions.
Also the database should be backed-up by your host at least every 24hrs, (if not change host). Unfortunately 'hacking' of databases through cms's is the favourite pastime of hackers, but it is a developers job to try and prevent this. This is why you should try and include a 'maintenance' contract as part of the package, this not only gives you a regular income but enables you to apply any know improvements required to your cms.
I am not a great fan of 'open-source' databases, mainly because they are the favourite type of site to hack, the code is freely available, and the location of the cms is well known.
Some time later the host has a major problem and loses all the database
updated information and consequently the site doesn't function correctly
anymore or at least loses the updated information (if that's possible?)
This is more often than not a consequence of the client altering something, (or someone they know well saying - "I can do improve that for you"), this is why I say use a maintenance contract that way you can check the date the pages where uploaded.
PZ
Similar Messages
-
How to get Hierarchical XML File from a Database Join Query !
Hi,
How can i get a Hierarchical XML File from a Database Join Query ?
Any join query returns repeated values as below:
BD17:SQL>select d.dname, e.ename, e.sal
2 from dept d
3 natural join
4 emp e
5 /
DNAME ENAME SAL
ACCOUNTING CLARK 2450
ACCOUNTING KING 5000
ACCOUNTING MILLER 1300
RESEARCH SMITH 800
RESEARCH ADAMS 1100
RESEARCH FORD 3000
RESEARCH SCOTT 3000
RESEARCH JONES 2975
SALES ALLEN 1600
SALES BLAKE 2850
SALES MARTIN 1250
SALES JAMES 950
SALES TURNER 1500
SALES WARD 1250
14 rows selected.
We tried use DBMS_XMLQUERY to generate a xml file, but it was unable to get xml in Hierarchical format.
<?xml version="1.0" encoding="ISO-8859-1" ?>
- <ROWSET>
- <ROW num="1">
<DNAME>ACCOUNTING</DNAME>
<ENAME>CLARK</ENAME>
<SAL>2450</SAL>
</ROW>
- <ROW num="2">
<DNAME>ACCOUNTING</DNAME>
<ENAME>KING</ENAME>
<SAL>5000</SAL>
</ROW>
- <ROW num="3">
<DNAME>ACCOUNTING</DNAME>
<ENAME>MILLER</ENAME>
<SAL>1300</SAL>
</ROW>
- <ROW num="4">
<DNAME>RESEARCH</DNAME>
<ENAME>SMITH</ENAME>
<SAL>800</SAL>
</ROW>
- <ROW num="5">
<DNAME>RESEARCH</DNAME>
<ENAME>ADAMS</ENAME>
<SAL>1100</SAL>
</ROW>
- <ROW num="6">
<DNAME>RESEARCH</DNAME>
<ENAME>FORD</ENAME>
<SAL>3000</SAL>
</ROW>
- <ROW num="7">
<DNAME>RESEARCH</DNAME>
<ENAME>SCOTT</ENAME>
<SAL>3000</SAL>
</ROW>
- <ROW num="8">
<DNAME>RESEARCH</DNAME>
<ENAME>JONES</ENAME>
<SAL>2975</SAL>
</ROW>
- <ROW num="9">
<DNAME>SALES</DNAME>
<ENAME>ALLEN</ENAME>
<SAL>1600</SAL>
</ROW>
- <ROW num="10">
<DNAME>SALES</DNAME>
<ENAME>BLAKE</ENAME>
<SAL>2850</SAL>
</ROW>
- <ROW num="11">
<DNAME>SALES</DNAME>
<ENAME>MARTIN</ENAME>
<SAL>1250</SAL>
</ROW>
- <ROW num="12">
<DNAME>SALES</DNAME>
<ENAME>JAMES</ENAME>
<SAL>950</SAL>
</ROW>
- <ROW num="13">
<DNAME>SALES</DNAME>
<ENAME>TURNER</ENAME>
<SAL>1500</SAL>
</ROW>
- <ROW num="14">
<DNAME>SALES</DNAME>
<ENAME>WARD</ENAME>
<SAL>1250</SAL>
</ROW>
</ROWSET>
Thank you for some help.
Nelson AlbertiHi,
I wrote a general ABAP program which can be configured to grab contrent from an URL and post that content as a new PI message into the integration adapter .... from that point on normal PI configuration can be used to route it to anywhere ...
It can be easily scheduled as a background job to grab content on a daily basis etc ...
Regards,
Steven -
General Query to identify parent columns and child columns in a table
Does anyone know a general query that can be run to identify the child records associated with the parent column within a single table.....and between other tables?
Am I correct in assuming the parent column is the 'primary key'?
Thanks.....I'm a new to oracle...and need some help understanding
my company's crazy DB structureYou can use
User_Constraints
User_Cons_Columns
views to identify parent and child table columns
SELECT * FROM User_Constraints WHERE Constraint_Type = 'R' AND Table_Name = '<TABLENAME>';
SELECT * FROM User_Cons_columns WHERE Constraint_Name = '<Name from Above query>';
will give you columns of the parent table (if you use value from constraint_name) and of child table (if you use value from r_constraint_name).
HTH.. -
Failed to mount database "General Users". Error: An Active Manager operation failed
Failed to mount database "General Users". Error: An Active Manager operation failed. Error: The database action failed. Error: Database 'General Users' on server 'EX02' cannot be mounted due to a previous error: At '12/3/2014
3:52:17 PM' the Exchange store database 'General Users' copy on this server appears to be inconsistent with the active database copy or is corrupted. For more details about the failure, consult the Event log on the server for other storage and "ExchangeStoreDb"
events. A successful failover restored service. If you have addressed the underlying problem, or if you have decided to attempt to mount the database despite this error, the mount operation may be attempted by using the '-Force' parameter of the Mount-Database
cmdlet. [Database: General Users, Server: EX02.domain.com]
Md. Ramin HossainHi,
From your description, it is recommended to suspend the failed database copy at first using the cmdlet below.
Suspend-MailboxDatabaseCopy -Identity "xxx"
And then reseed the database with a new copy using Update-MailboxDatabaseCopy -Identity "xxx" -DeleteExistingFiles cmdlet.
What's more, here is a helpful thread for your reference.
Update-MailboxDatabaseCopy
http://technet.microsoft.com/en-us/library/dd335201(v=exchg.150).aspx
Hope this can be helpful to you.
Best regards,
Amy Wang
TechNet Community Support -
Why a "Database - General" category?
After my previous wish list - for more effective forums > during posting new questions can this be done?
This time I want to ask do we really need a "General" category after all these categories, I think this category decreases the efficiency of the posts.
Like "SQL and PL/SQL" or "Installation" there could be a "Database - Backup&Recovery" and "Database - Performance Tuning" categories but not a "General" one please, lots of people are tired of warning others for the appropriate forum category to post.
Best regards.Interesting question. I do agree with the idea behind the question.
But I do not see it happening - when the typical forum user has a question, they want an answer but they do not want to spend a lot of time looking for the right place to find the answer .... or they would be checking the docs or asking where to find the answer in the docs.
People can not even be bothered to enter the database - general questions in the 'Database; group of forums. Instead we are seeing database questions dumping in the Feedback forum ... probably because it's the first one.
Part of the problem is there are too many sub-categories.
Part of the problem is there are too few people answering in the sub-catgories.
Databases - Installation was a fairly slow forum. I started answering there exclusively for a while. I note that the number of discussions has increased dramatically since I started responding. (I do not take credit for this, but I think perhaps having one more knowledgeable respondent helped.)
We may be dealing with the "MacDonald's syndrome" in which "popular and advertised" attracts attention. After all, the popular forums are advertised (show up more often) on OTN and Google.
So perhaps the answer is simple - start answering in a specific forum and people will be attracted to that forum. Then maybe the 'Database - General' will only attract newbies who get no answers becuase all the seriouus users are elsewhere.
The other side of the same coin isL when you are a DBA, how much time do you really spend with each of the specialty topics? How many real experts do we have in those? (I know only 1 Workflow specialist outside of Oracle for the Workflow forum, only a smnall handful in the Spatial forum, very few who are truly adept at AQ or Streams ...) -
Hi,
I have a general query in OSB. Whenever I try to add any expression through any message processing controls, there are three other tabs, comments, namespaces and variables. Can someone explain what is the use of namespaces and variables. If possible with the help of an example.
Thanks,
BalsHi Bals,
Comments allow the developer to put some lines regarding the functionality of that action/stage. This is same as putting comment in any programming language.
XML Namespaces provide a method to avoid element name conflicts in a XML. To know more please refer -
http://www.w3schools.com/xml/xml_namespaces.asp
Variables section refers to the message context variables like $header, $body, $inbound, $outbound etc. You may refer below link to know more -
http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/userguide/context.html
Regards,
Anuj -
Need help on performing database queries with a general query
Dear experts,
I have two issues
1)
I have developed a software which connects to Oracle database
performing and executing DDL/DML statements.
I am using a Jdbc thin oracle driver.
When i perform a wrong syntax query or say a query using invalid column.I get exception accordingly.However,I want to know if there is any way by which i can know the exact position where i am making error
just as an asterik(*) comes in sql plus in case of invalid column or so.
2)
Whenever i minimize software window (made of swing components)
and again maximize it.It takes almost 12 secs to be visible otherwise it remains white.Is swing that much slow ???(1) No.
(2) It's possible to make Swing programs that slow. (I know, I have done it.) But usually the slowness is in application code (your code) and not in Swing itself. -
Hi,
A process generally takes 2-3 hours in our database. But one day it got stuck at a particular query and remained in that state for 20 long hours after which we had to kill the process and restart it. Second time it ran smoothly.
The details of the cache sizes of the database are as follows::
Cache Sizes (end)
~~~~~~~~~~~~~~~~~
Buffer Cache: 512M Std Block Size: 8K
Shared Pool Size: 160M Log Buffer: 2,048K
What could be the possible reason for this behaviour?
Thanks,
PaulamiHere is the statspack report....
Top 5 Timed Events
~~~~~~~~~~~~~~~~~~ % Total
Event Waits Time (s) Ela Time
db file sequential read 212,871,657 562,034 49.52
CPU time 162,292 14.30
wait for unread message on broadcast channel 338,490 145,170 12.79
buffer busy waits 31,244,353 127,259 11.21
enqueue 108,964 59,937 5.28 -
Use of current time for polling Database Adapter query
I am writing a simple BPEL process with a Polling Database Adapter and a Recieve. The idea is that we are polling an XE database for any entries in a TRIP table which have an expiration date/time field that has passed.
The Adapter was build using JDeveloper 10.1.3.2 (with Oracle Application Server patched to 10.1.3.3.0) as a "Poll for New Changed Records in a Table" Operation type with a STATUS field (0 for live, 1 for expired) as the Logical Delete Field.
I was unable to find a way to generate a SELECT query expression with the wizard that would allow me to use current/system time as an attribute, so I finished the wizard and edited the Toplink Descriptor to use a custom SQL expression for the query. This resulted in the following code in the toplink_mappings.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<toplink:object-persistence version="Oracle TopLink - 10g Release 3 (10.1.3.1.0) (Build 061004)"
xmlns:opm="http://xmlns.oracle.com/ias/xsds/opm" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:toplink="http://xmlns.oracle.com/ias/xsds/toplink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<opm:name>ExpiredTripPoller</opm:name>
<opm:class-mapping-descriptors>
<opm:class-mapping-descriptor xsi:type="toplink:relational-class-mapping-descriptor">
<opm:class>ExpiredTripPoller.Trip</opm:class>
<opm:alias>Trip</opm:alias>
<opm:primary-key>
<opm:field table="TRIP" name="ID" xsi:type="opm:column"/>
</opm:primary-key>
<opm:events xsi:type="toplink:event-policy"/>
<opm:querying xsi:type="toplink:query-policy">
<opm:queries>
<opm:query name="ExpiredTripPoller" xsi:type="toplink:read-all-query">
<toplink:timeout>0</toplink:timeout>
<toplink:call xsi:type="toplink:sql-call">
<toplink:sql>SELECT ID, LPN, START_TIME, EXPIRY_TIME, STATUS FROM TRIP WHERE ((STATUS = '0') AND (EXPIRY_TIME < SYSDATE)) ORDER BY EXPIRY_TIME ASC</toplink:sql>
</toplink:call>
<toplink:reference-class>ExpiredTripPoller.Trip</toplink:reference-class>
<toplink:cache-usage>primary-key</toplink:cache-usage>
<toplink:lock-mode>none</toplink:lock-mode>
<toplink:container xsi:type="toplink:list-container-policy">
<toplink:collection-type>java.util.Vector</toplink:collection-type>
</toplink:container>
</opm:query>
<opm:query name="findAllTrip" xsi:type="toplink:read-all-query">
<toplink:timeout>0</toplink:timeout>
<toplink:reference-class>ExpiredTripPoller.Trip</toplink:reference-class>
<toplink:cache-usage>primary-key</toplink:cache-usage>
<toplink:lock-mode>none</toplink:lock-mode>
<toplink:container xsi:type="toplink:list-container-policy">
<toplink:collection-type>java.util.Vector</toplink:collection-type>
</toplink:container>
</opm:query>
</opm:queries>
<toplink:does-exist-query xsi:type="toplink:does-exist-query">
<toplink:existence-check>check-database</toplink:existence-check>
</toplink:does-exist-query>
<toplink:read-all-query xsi:type="toplink:read-all-query">
<toplink:reference-class>ExpiredTripPoller.Trip</toplink:reference-class>
<toplink:container xsi:type="toplink:list-container-policy">
<toplink:collection-type>java.util.Vector</toplink:collection-type>
</toplink:container>
</toplink:read-all-query>
</opm:querying>
<opm:attribute-mappings>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>id</opm:attribute-name>
<opm:field table="TRIP" name="ID" xsi:type="opm:column"/>
<opm:attribute-classification>java.math.BigDecimal</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>lpn</opm:attribute-name>
<opm:field table="TRIP" name="LPN" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>startTime</opm:attribute-name>
<opm:field table="TRIP" name="START_TIME" xsi:type="opm:column"/>
<opm:attribute-classification>java.sql.Timestamp</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>expiryTime</opm:attribute-name>
<opm:field table="TRIP" name="EXPIRY_TIME" xsi:type="opm:column"/>
<opm:attribute-classification>java.sql.Timestamp</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>status</opm:attribute-name>
<opm:field table="TRIP" name="STATUS" xsi:type="opm:column"/>
<opm:attribute-classification>java.math.BigDecimal</opm:attribute-classification>
</opm:attribute-mapping>
</opm:attribute-mappings>
<toplink:descriptor-type>independent</toplink:descriptor-type>
<toplink:caching>
<toplink:cache-type>weak-reference</toplink:cache-type>
<toplink:always-refresh>true</toplink:always-refresh>
</toplink:caching>
<toplink:remote-caching>
<toplink:cache-type>weak-reference</toplink:cache-type>
</toplink:remote-caching>
<toplink:instantiation/>
<toplink:copying xsi:type="toplink:instantiation-copy-policy"/>
<toplink:change-policy xsi:type="toplink:deferred-detection-change-policy"/>
<toplink:tables>
<toplink:table name="TRIP"/>
</toplink:tables>
</opm:class-mapping-descriptor>
</opm:class-mapping-descriptors>
</toplink:object-persistence>
To test I used the above custom SQL at the command line and it filtered the records by EXPIRY_TIME as expected.
When deployed, the polling process updates the STATUS file dof table entries, but all entries with status 0 regardless of EXPIRY_DATE. My modification appears to be being ignored. I was unsure as to whether the QUERY was being determined in some other way so I modified the descriptor (with the toplink expression editor) to compare against a literal time value, producing the following modified toplink_mappings.xml:
<?xml version="1.0" encoding="UTF-8"?>
<toplink:object-persistence version="Oracle TopLink - 10g Release 3 (10.1.3.1.0) (Build 061004)"
xmlns:opm="http://xmlns.oracle.com/ias/xsds/opm" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:toplink="http://xmlns.oracle.com/ias/xsds/toplink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<opm:name>ExpiredTripPoller</opm:name>
<opm:class-mapping-descriptors>
<opm:class-mapping-descriptor xsi:type="toplink:relational-class-mapping-descriptor">
<opm:class>ExpiredTripPoller.Trip</opm:class>
<opm:alias>Trip</opm:alias>
<opm:primary-key>
<opm:field table="TRIP" name="ID" xsi:type="opm:column"/>
</opm:primary-key>
<opm:events xsi:type="toplink:event-policy"/>
<opm:querying xsi:type="toplink:query-policy">
<opm:queries>
<opm:query name="ExpiredTripPoller" xsi:type="toplink:read-all-query">
<opm:criteria operator="lessThan" xsi:type="toplink:relation-expression">
<toplink:left name="expiryTime" xsi:type="toplink:query-key-expression">
<toplink:base xsi:type="toplink:base-expression"/>
</toplink:left>
<toplink:right xsi:type="toplink:constant-expression">
<toplink:value xsi:type="xsd:date">2007-07-30</toplink:value>
</toplink:right>
</opm:criteria>
<toplink:timeout>0</toplink:timeout>
<toplink:reference-class>ExpiredTripPoller.Trip</toplink:reference-class>
<toplink:cache-usage>primary-key</toplink:cache-usage>
<toplink:lock-mode>none</toplink:lock-mode>
<toplink:container xsi:type="toplink:list-container-policy">
<toplink:collection-type>java.util.Vector</toplink:collection-type>
</toplink:container>
</opm:query>
<opm:query name="findAllTrip" xsi:type="toplink:read-all-query">
<toplink:timeout>0</toplink:timeout>
<toplink:reference-class>ExpiredTripPoller.Trip</toplink:reference-class>
<toplink:cache-usage>primary-key</toplink:cache-usage>
<toplink:lock-mode>none</toplink:lock-mode>
<toplink:container xsi:type="toplink:list-container-policy">
<toplink:collection-type>java.util.Vector</toplink:collection-type>
</toplink:container>
</opm:query>
</opm:queries>
<toplink:does-exist-query xsi:type="toplink:does-exist-query">
<toplink:existence-check>check-database</toplink:existence-check>
</toplink:does-exist-query>
<toplink:read-all-query xsi:type="toplink:read-all-query">
<toplink:reference-class>ExpiredTripPoller.Trip</toplink:reference-class>
<toplink:container xsi:type="toplink:list-container-policy">
<toplink:collection-type>java.util.Vector</toplink:collection-type>
</toplink:container>
</toplink:read-all-query>
</opm:querying>
<opm:attribute-mappings>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>id</opm:attribute-name>
<opm:field table="TRIP" name="ID" xsi:type="opm:column"/>
<opm:attribute-classification>java.math.BigDecimal</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>lpn</opm:attribute-name>
<opm:field table="TRIP" name="LPN" xsi:type="opm:column"/>
<opm:attribute-classification>java.lang.String</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>startTime</opm:attribute-name>
<opm:field table="TRIP" name="START_TIME" xsi:type="opm:column"/>
<opm:attribute-classification>java.sql.Timestamp</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>expiryTime</opm:attribute-name>
<opm:field table="TRIP" name="EXPIRY_TIME" xsi:type="opm:column"/>
<opm:attribute-classification>java.sql.Timestamp</opm:attribute-classification>
</opm:attribute-mapping>
<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>status</opm:attribute-name>
<opm:field table="TRIP" name="STATUS" xsi:type="opm:column"/>
<opm:attribute-classification>java.math.BigDecimal</opm:attribute-classification>
</opm:attribute-mapping>
</opm:attribute-mappings>
<toplink:descriptor-type>independent</toplink:descriptor-type>
<toplink:caching>
<toplink:cache-type>weak-reference</toplink:cache-type>
<toplink:always-refresh>true</toplink:always-refresh>
</toplink:caching>
<toplink:remote-caching>
<toplink:cache-type>weak-reference</toplink:cache-type>
</toplink:remote-caching>
<toplink:instantiation/>
<toplink:copying xsi:type="toplink:instantiation-copy-policy"/>
<toplink:change-policy xsi:type="toplink:deferred-detection-change-policy"/>
<toplink:tables>
<toplink:table name="TRIP"/>
</toplink:tables>
</opm:class-mapping-descriptor>
</opm:class-mapping-descriptors>
</toplink:object-persistence>
On deployment, this version of the BPEL process behaved as expected - only modifying the records with EXPIRY_TIME less thatn the literal time specified. (Also, I can't really pass in the time as a parameter as this is a polling model).
Can anyone shed any light on what is happening or suggest how I might go about polling in the desired way?
CheersPlease take a look at this article which states SYSDATE is not supported in a
where clause.
http://www.oracle.com/technology/pub/articles/bpel_cookbook/qualcomm-bpel.html
Excerpt from the article:
Here are three important things you should do in implementing the above design:
Have the status of the record being processed stored in the database. The status includes the process state, next process attempt time, and processing attempt count.
Create an updatable view that exposes only records that are ready to be processed. A view is needed because the database adapter cannot handle a where clause that compares against SYSDATE.
Design logic that determines if a process instance that has faulted should be retried and when the retry should occur. This information will be updated in the database by use of a stored procedure. This can also be done with an update partner link and additional logic in BPEL.
mahalo,
a iii -
hi experts,
Can i create a query using Logical Database?
if yes how?? Pls give an idea...
Thanks in advance.Hi Manisha,
We can write select query on Logical Databases(LDB) as we write for our normal database. But it is not recommended to write SELECT queries on LDBs.
Genereally we use standard predefined macros for the selection from LDBs.
Hope this helps you.
Regards,
Chandra Sekhar -
Oracle database parallel query
Hello,
I am trying to execute a pararallel query in oracle oracle database 10g but it is not working. please see the below server settings and explain plan.
NAME TYPE VALUE
fast_start_parallel_rollback string LOW
parallel_adaptive_multi_user boolean TRUE
parallel_automatic_tuning boolean TRUE
parallel_execution_message_size integer 4096
parallel_instance_group string
parallel_max_servers integer 40
parallel_min_percent integer 0
parallel_min_servers integer 0
parallel_server boolean TRUE
parallel_server_instances integer 2
parallel_threads_per_cpu integer 2
xplain plan of SELECT /*+ PARALLEL(a, 2) */ * FROM prt_sales_disc_matrix where sdm_crt_user='sys'
Plan
SELECT STATEMENT ALL_ROWS Cost: 89,113 Bytes: 144 Cardinality: 1
1 TABLE ACCESS FULL TABLE PRISM.PRT_SALES_DISC_MATRIX Cost: 89,113 Bytes: 144 Cardinality: 1Apart from the important syntactical error which sb has highlighted, the parallel hint does not mandate that the statement is run in parallel.
http://jonathanlewis.wordpress.com/2007/06/17/hints-again/ -
Access database dynamic query output...
Dear CF Colleagues:
I need to run a loop for 4 times, to access four seperate values out of a data row in a test results table (tbl_results), where all four are in the row of the student (WHERE studentid = etc).
It looks like this...
<cfset variables.TimeTotals = 0>
<cfloop from="1" to="4" step="1" index="timrec">
<cfquery datasource="mydsn" name="rs_time">
SELECT Btime#timrec#
FROM tbl_results
WHERE studentid = 'jack';
</cfquery>
<cfset variables.TimeTotals = variables.TimeTotals + (????? rs_time.Btime#timrec# value ?????)>
</cfloop>
*** QUESTION: How do I address that Btime#timrec# value? Not in this way, I know, but how?
Looking forward to your wisdom, with gratitude,
HansAs Reed says, many ways to tackle this.
I would also point out the ability to ready all the BTIme... columns with one query then loop through the columns to total that time.... OR total them in the database.
These both have the advantage of only needing one network connection to the database, which is the slowest part of this process.
A)
<cfquery name rs_time ...>
SELECT Btime1, Btime2, Btime3 Btime4
</cfquery>
<cfset variable.TimeTotals = 0>
<cfloop list="#rs_time.columnList#" index="col">
<cfif left(col,5) EQ "BTIME"><cfset variables.TimeTotals = variable.TimeTotals + rs_time[col][1]>
</cfloop>
B)
<cfquery name="rs_time"...>
SELECT Btime1 + Btime2 + Btime2 + Btime4 AS totalTime
</cfquery>
OF COURSE
I would be remis if I did not point out that you would have a more expandable database design if you normalized this so that the test times where not columns in the tbl_resluts table but rather rows. -
Database migration query not executing in database
We moved over our SQL database to another server. We have a few .cfm template files that have queries to get 'content' from our database. These queries in the .cfm template files work fine and execute properly. However, for some reason, since we moved over our database, the queries in the actual database don't execute/run anymore. In the old server we didn't have this problem. Our queries in the database would run properly then. The data would display correctly on the webpages.
Is there some kind of properties setup that was overlooked when migrating over our database?
The output we now see when viewing our pages is the actual query code.
Example:
SELECT lname
FROM table
This is actually displayed on the website and therefore the query is not executing/running. Our code was never changed. So why is it not outputting the same?
Thanks for any help provided.Sorry for the confusion.
The coldfusion templates and database queries both worked fine on the previous old server.
Now since the migration onto the new server, only the coldfusion templates work fine, but not the queries in the database.
So for example, a query in the coldfusion template will run fine, and execute the intial pull of data. But once the content is pulled from the database, the queries inside the database (including stored procedures) don't execute.
We do get the expected results when we run our stored procedure in Management Studio and if we put the stored procedure on a standalone web page we do see the records.
We only see the sql code when we have the stored procedure inside of our w_content table of our database, and its being called by the first query in the template. For some odd reason the stored procedure does not execute if it is inside the database.
Hopefully that clarifies our problem.
Thank you for helping! -
Hi
I want to write a query which takes a argument such as a number n.
The query is used to get any nth largest number from a table.
I could write it for only one say getting the second largest number. I wrote it as:
A= Select * from Emp where sal !=(select max(sal) from Emp);
select max(sal) from A;
It is very complex to make this query a General one.
Can any body suggest an idea.
thanksselect ename, sal from (select row_number() over (order by sal desc) r, ename, sal from emp) where r=&n;
Enter value for n: 5
ENAME SAL
BLAKE 2850
Please read the documentation about the differences between rank(), dense_rank() and rownumber()
Regards
Laurent Schneider
OCM DBA -
OVD: Database Adapter Query Problem
Hey Everyone,
I am using a database adapter in OVD 10g and am not able to get the proper results from a query. We have created a view in the database and have pointed OVD at the view. We then set up 7 objectclasses using the DB Attribute Mapping Wizard. When doing a query on the base of the DB adapters we are not getting back all of the proper results one would expect. For instance if I query for objectclass=* I only get back 2 of the 7 objectclasses. Another example would be a query for mail=[email protected] will only return the attributes from the mailRecipient objectclass when normally in LDAP the entire record would be returned.
Does anyone have an idea as to what could be going on? Does anyone have additional resources (beyond the OVD manual) for creating a database adapter?
Thanks,
StephenSorted this out:
Used custom URL and made sure that the OVD Manager IDE was not appending any additional information following the closing bracket of the URL.
The full successful URL was as follows with no values in any of the other fields:
jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=on)(ADDRESS = (PROTOCOL = TCP)(HOST = host1)(PORT = 1540))(ADDRESS = (PROTOCOL = TCP)(HOST = host2)(PORT = 1540))(CONNECT_DATA=(SERVICE_NAME=SNAME)))
Maybe you are looking for
-
POSTING WITH A DOCUMENT TYPE WITH DIFFERENT EXCHANGE RATE TYPES
Hi there, We have different company codes in the same client. These companies are situated in various countries. I like to use the same document type with several exchange types M and X(specific for countries). Posting in MM and SD are ok by defining
-
So I understand clearly, when you're working on a RAW image are you actually seeing the "preview" file on screen or the actual RAW file? I'd hate to judge the adjustments I'm making based on a jpeg.
-
i have downloaded the output module for Bridge cc, now how do i create a contact sheet from this?
-
Efficient captioning in Bridge?
With the advent of CS5, I decided to once again try captioning a pile of photos in Bridge. Previously whenever I've looked at this, I've decided that PhotoMechanic works much better. By "captioning" I mean setting the XMP metadata for a large set of
-
Looking for customer database template
A buddy of mine just got an ipad and since I have an ipad as well he wants me to create a simple customer list for his small business, since he does everything with pencil and paper. There is a template called Checklist and when you click on new for