Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all 13329 articles
Browse latest View live

Data Modelling

$
0
0
Hello there,

Data can be modelled at logical level and physical level.After logical design ie ER Model ,we convert it to physical model ie Tables. . Tables are created in case of RDBMS. But the data is not actually stored as TABLES on the disk.It is yet again a way to represent the day for processing. Then how is the data actually stored ? Is it the responsibility of the DBMS alone, to define the storage structures ? How does this work ?

Thanks in Advance.

Hello!!

$
0
0
Hello everyone, I'm new here :) I hope to contribute on this forum as much as possible.

Greets from Venezuela!

Database design for a language learning tool

$
0
0
Hello everyone, I'm planning at this moment to build a language learning tool for personal use, since I'm still learning English (I plan to open source the application), so excuse me for any grammar mistakes made on this post.

This application is going to be based on two tools named Learning With Texts (LWT) and LingQ, both are based on a methodology to learn languages based on reading.

You can see an example of LWT on the attachment.

I'm still thinking about how to design the database but I've seen that I'll need a query to search for the words contained in the text on a constant basis. The data I'm going to search has the status of the words learned by the user. For example
  • Learned
  • In process of learning
  • Not learned

Let's say I have a text like this:

Quote:

"I'm hitting the hay at this moment"
Somewhere I have the following list of words
  • I'm
  • hitting
  • hay
  • moment
  • hitting the hay
  • other words...

How can I retrieve the values in the list above that are currently contained on the text being read in an efficient way using a RDBMS?

I hope I explained well myself, if not, please let me know, I will try to post more information as soon as possible.

Thanks in advance

Attached Images
File Type: png eUz4sY4.png (72.6 KB)

error while insatalling oracle 11g

$
0
0
Hi all,

I am installing oracle 11g enterprise edition x86 downloaded from website on a fresh RHEL 6 32bit OS machine.

Installer get launched successful but later installation get aborted with following error:

error in involking targer 'client_sharedlib' of makefile 'u01/app/oracle/product/11.2.0/dbhome_1/rdbms/lib/ins_rdbms.mk'

Can any bode has any idea / experience why this problem is coming. It seems there is some problem is in library RPM please tell me which RPM to install ?


Thanks in advance.

sumit

how make db for refrence in sql

$
0
0
hi there
i am making a project where i have to add city,agentname,rankofagent,refrenceagentname
the problem is that who can i make a table where suppose i add member a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p
like that b is joined by a
c is joined by b
d by c, e by d and so on,
what i want here is that how can i get the result suppose i want to see that chain of p.
i want result to be printed as a,b,c,d,e,f,g,h,i,j,k,l,m,n,o
either result should be in horizontal form or vertical. with or withought comma.
kindly help me to design and implement the query.
i am doing this in SQL :rolleyes:

Web Injection Errors

$
0
0
I am writing a query with a series of unions to help display columns into rows. I am getting a web injection error which I have never come across. I have read all I can on this topic but cannot seem to find the error / solution to my code. Any suggestions?

Code:

SELECT
  trainee.name,
  '1' AS Session,
  '1' AS Unit,
  'SITXOHS001B' AS 'Unit Code',
  CASE
      WHEN tp_sit30707.sitxohs001b_canvas = '1' THEN 'Complete'
      ELSE 'Canvas Assessment'
  END AS 'Assessment Due' 
FROM
  trainee 
INNER JOIN
  tp_sit30707_trainee_c 
      ON trainee.id = tp_sit30707_trainee_c.tp_sit30707_traineetrainee_idb 
      AND tp_sit30707_trainee_c.deleted = 0 
INNER JOIN
  tp_sit30707 
      ON tp_sit30707_trainee_c.tp_sit30707_traineetp_sit30707_ida = tp_sit30707.id 
      AND tp_sit30707.deleted = 0 
      AND tp_sit30707.sitxohs001b_dd = 'RCC' 
INNER JOIN
  tp_sit30707_cstm 
      ON tp_sit30707.id = tp_sit30707_cstm.id_c 
UNION
ALL SELECT
  trainee.name,
  '1' AS Session,
  '2' AS Unit,
  'SITXOHS002A' AS 'Unit Code',
  CASE
      WHEN tp_sit30707.sitxohs002a_canvas = '1' THEN 'Complete'
      ELSE 'Canvas Assessment'
  END AS 'Assessment Due' 
FROM
  trainee 
INNER JOIN
  tp_sit30707_trainee_c 
      ON trainee.id = tp_sit30707_trainee_c.tp_sit30707_traineetrainee_idb 
      AND tp_sit30707_trainee_c.deleted = 0 
INNER JOIN
  tp_sit30707 
      ON tp_sit30707_trainee_c.tp_sit30707_traineetp_sit30707_ida = tp_sit30707.id 
      AND tp_sit30707.deleted = 0 
      AND tp_sit30707.sitxohs002a_dd = 'RCC' 
INNER JOIN
  tp_sit30707_cstm 
      ON tp_sit30707.id = tp_sit30707_cstm.id_c

Thanks

Db2 upgrade from v8.1 to v10.1

$
0
0
Hi Everyone,

There is a change in DB UPGRADE from v8.1 tov10.1

Could you please let me know what are the respective changes form appliation perspective.
Eg: Stored procedures
Sql queries
driver name
jar files
data source etc etc

show a text+Blob Field in crystal report

$
0
0
I need to show a text+Blob Field in crystal report (Embedded in visual Studio) in detail section of CR. we want to show the image next to text meaning where ever text ends image should display. but unable to find a way where we can set image placement relative to text field. your help will be really appreciated.

Table function that modifies data

$
0
0
Hi,

I have the following function in DB2 but while creating its giving error
DB2 Database Error: ERROR [42613] [IBM][DB2/LINUXX8664] SQL0628N Multiple or conflicting keywords involving the "RETURNS" clause are present. LINE NUMBER=4. SQLSTATE=42613


Function :



SET CURRENT PATH = "SYSIBM","SYSFUN","SYSPROC","SYSIBMADM","ACHINST1" ;

CREATE OR REPLACE FUNCTION ACHINST1.AGING (
X DATE,
Y INTEGER )
returns table(vivek DATE)
LANGUAGE SQL
MODIFIES SQL DATA
NO EXTERNAL ACTION
DETERMINISTIC
begin


declare counter_insert int;
declare counter_tat int;
declare store int;
declare i int;
declare creation_day int;
declare creation_month int;
declare creation_year int;
declare expairy_day int;
declare tat int;
declare actual_month int;
declare tat_date varchar(20);
declare month_days int;
declare expairy_id int;
declare return_value varchar(20);
declare holiday_counter int;
declare actual_return date;

declare c1 cursor for
select length(B.days|| B1.days) from ACHINST1.DMSBUSINESSCALENDAR as B inner join ACHINST1.DMSBUSINESSCALENDAR as B1
ON B1.BC_MONTH = (CASE WHEN B.BC_MONTH < 11 THEN B.BC_MONTH+1 ELSE 0 END)
AND B1.BC_YEAR = (CASE WHEN B.BC_MONTH = 11 THEN B.BC_YEAR+1 ELSE B.BC_YEAR END)
where B.STATUS = 'ACTIVE' and B.calendarkey = 'INR' and B1.CALENDARKEY = 'INR' and B1.status = 'ACTIVE'
and b.bc_month = actual_month and b.bc_year = creation_year;
set counter_insert = 1;
set creation_day = day(x);
set creation_month = month(x);
set actual_month = creation_month -1;
set creation_year = year(x);
set expairy_day = creation_day;
set expairy_id=creation_day;

set tat = y;
set counter_tat = 1;


if actual_month = 0
then set month_days = 31;

elseif actual_month = 1
then
if ((mod(creation_year,4) = 0) AND ((mod(creation_year,100) != 0) OR (mod(creation_year,400) = 0)))
then set month_days = 29;
else
set month_days = 28;
end if;

elseif actual_month = 2
then set month_days = 31;

elseif actual_month = 3
then set month_days = 30;

elseif actual_month = 4
then set month_days = 31;

elseif actual_month = 5
then set month_days = 30;

elseif actual_month = 6
then set month_days = 31;

elseif actual_month = 7
then set month_days = 31;

elseif actual_month = 8
then set month_days = 30;

elseif actual_month = 9
then set month_days = 31;

elseif actual_month = 10
then set month_days = 30;

elseif actual_month = 11
then set month_days = 31;
end if;






open c1;
fetch c1 into store;
close c1;



while (counter_insert <= store) do

insert into achinst1.calender values (counter_insert, (select substr((B.days|| B1.days),counter_insert,1) from ACHINST1.DMSBUSINESSCALENDAR as B inner join ACHINST1.DMSBUSINESSCALENDAR as B1
ON B1.BC_MONTH = (CASE WHEN B.BC_MONTH < 11 THEN B.BC_MONTH+1 ELSE 0 END)
AND B1.BC_YEAR = (CASE WHEN B.BC_MONTH = 11 THEN B.BC_YEAR+1 ELSE B.BC_YEAR END)
where B.STATUS = 'ACTIVE' and B.calendarkey = 'INR' and B1.CALENDARKEY = 'INR' and B1.status = 'ACTIVE'
and b.bc_month = actual_month and b.bc_year = creation_year));
set counter_insert = counter_insert+1;
end while;


while (counter_tat <= tat) do


if exists (select value from calender where id = expairy_id and value = 1)
then
set counter_tat = counter_tat+1;
end if;
if expairy_day = month_days
then
if creation_month = 12
then
set expairy_day = 1;
set creation_month = 1;
set creation_year = creation_year+1;
else
set expairy_day = 1;
set creation_month = creation_month + 1;
end if;
else
set expairy_day = expairy_day+1;
end if;
set expairy_id = expairy_id+1;

end while;

set holiday_counter = counter_tat + 1;

while exists (select value from calender where id = expairy_id and value = 0) do


if expairy_day = month_days
then
if creation_month = 12
then
set expairy_day = 1;
set creation_month = 1;
set creation_year = creation_year+1;
else
set expairy_day = 1;
set creation_month = creation_month + 1;
end if;
else
set expairy_day = expairy_day+1;
end if;
set expairy_id = expairy_id+1;
end while;

set return_value = (creation_year || '-' ||creation_month || '-' || expairy_day);
delete from achinst1.CALENDER;
insert into datastore values (return_value);


set actual_return = date(to_date(return_value,'DD-MM-YYYY'));


return (select rtr from achinst1.datastore where rtr = return_value);

end;



Can some one help me???

Site Scope Alerts in DB2z

$
0
0
Is it possible to have Sitescope monitors that trigger when there are new entries to a specific table? We would like to put some monitoring on our error tables. We like to understand our options

We are in Db2 V10.1 on z/OS.

Image saving in MS SQL 2005/2008 DB

$
0
0
Dear Friend,

I have developed on winodws based application using C# in .NET. I am connecting from my database using internet, means my database kept on remote location. I have to save images in DB because I can't save and access images in external folder from remote location. In this situation my DB is growing very fast. Is there any other alternative to work on this requirement or compress image in any format so that I can reduce DB size.

I am looking help on urgent basis. Thanks for your support in advance.

Regards,
Rajeev

two vm can open the same database instance at the same time

$
0
0
Can we set up MySQL(5.5) database in this way:
all the database files are in NFS storage and there are two VM mounted to
this same NFS storage. And both two VMs start up this database? I ran into this
situation and it works. I cannot find any document saying that two servers can start up the same MySQL database instance at the same time.
Does someone have this experience? thank you!

Merge duplicate/similar records into 1 record in Access 2010

$
0
0
Is there a way to merge duplicate/similar Access 2010 records into one record? I have researched this question numerous times and have not found an answer specific to my needs.

I have an Access table with 1,000 duplicate records, although they are similar and not exact duplicates. As you can see below, some records contain information that other records do not. Yet, the primary key is the same for all duplicate records. I want to find a way to merge data from filled cells of duplicate records into empty cells for each duplicate record. I do not want to concatenate the data (i.e. combine last and first name, etc.). I only want to fill empty cells if there is a match for it in a duplicate record. I will delete the newly exact duplicate records later. Short of correcting the records by hand, (which is what I’m doing now) I do not have a solution.

Thanks!

Code:

LastName  FirstName  SSN          Address          Phone        Email
Doe      John      123-45-7891  123 Anywhere St. NULL          john(at)gmail.com
Doe      John      123-45-7891  NULL            (123)456-7890 NULL

Desired Result
Code:

LastName  FirstName  SSN          Address          Phone        Email
Doe      John      123-45-7891  123 Anywhere St. (123)456-7890 john(at)gmail.com
Doe      John      123-45-7891  123 Anywhere St. (123)456-7890 john(at)gmail.com

u01 space issue

$
0
0
Hi,

We assigned 150 GB to /u01. since few weeks we noticed its filling very fast.
df -h shows available 3.2gb...i clean up the logs alerts and dumps. then it will came back to 15gb. but i am not sure what is root cause....

oracle 11gr2 enterprize edition....with linux6 version....

i am planning to use the ADRCI but not sure about the licensing. please suggest...

backup oracle tables with c#

$
0
0
Hi,

I'm trying to backup data from 12 different tables with a c# script. The backup tables have already been created and have been populated with the original table data. The problem that I'm in is that the script is supposed to check the backup table against the original table and just add the new rows that have been added to the new table.

For example:
table_1 is the original with its backup being table_1_bk (the same for the other 11 tables). At this point they have the same data, by the end of everyday new data is added to table_1 so when the script is run at eod it needs to detect the new rows and add them to the backup table. Any suggestions are greatly appreciated

Time range help

$
0
0
Hi All,

Please help me for this.

I have a data like below.
Now I want to show the employees who are in store based on the dataetime given.
Here the emp came on 9am and left at 11 am.And again he cam on 12.30 pm and left at 19 pm .I gave datatime as 2014-05-15 09:15:45 .
For this time the
employee is in store but I am not able to fetch the data.

But I am unable to get the data.
Please help me

Empno ClockDate ClockTime ClockType
1 2014-05-15 2014-05-15 09:00:00 I
1 2014-05-15 2014-05-15 11:00:00 O
1 2014-05-15 2014-05-15 12:30:00 I
1 2014-05-15 2014-05-15 19:00:00 O

This is my query :

SELECT DISTINCT a.emp_a,clock_date_1,a.clock_time,b.clock_time FROM
(SELECT MAX(clock_time) clock_time,employee_no AS emp_a,clock_date clock_date_1 FROM clock_time WHERE
clock_type='I' GROUP BY clock_type,emp_a,clock_date )a,
(SELECT MAX(clock_time) clock_time,employee_no AS emp_b FROM clock_time WHERE clock_type='O' GROUP BY clock_type,emp_b)b
WHERE '2014-05-23 09:15:45' BETWEEN a.clock_time AND b.clock_time
AND a.emp_a=b.emp_b
AND a.emp_a=1

Spliting a column into Multiple columns

$
0
0
Hi Guys,

I have to split a column using comma a delimiter into multiple columns.

I am able to do it if i know how many column will be present in the final output.

But in daily run, the columns may vary randomly.

Thats where i need help how to split columns without hardcoding how many columns it ll come.

This is the code am using

Code:

WITH Split_Names (Fil_id,Name, xmlname)
AS
(
    SELECT Fil_ID,
    Allergen,
    CONVERT(XML,'<Names><name>' 
    + REPLACE(Allergen,',', '</name><name>') + '</name></Names>') AS xmlname
      FROM stg.T_STG_Allergen
)

 SELECT  Fil_id,
  xmlname.value('/Names[1]/name[1]','varchar(100)') AS aller1,   
 xmlname.value('/Names[1]/name[2]','varchar(100)') AS aller2,
 xmlname.value('/Names[1]/name[3]','varchar(100)') AS aller3,
 xmlname.value('/Names[1]/name[4]','varchar(100)') AS aller4,
 xmlname.value('/Names[1]/name[5]','varchar(100)') AS aller5,
 xmlname.value('/Names[1]/name[6]','varchar(100)') AS aller6,
 xmlname.value('/Names[1]/name[7]','varchar(100)') AS aller7,
 xmlname.value('/Names[1]/name[8]','varchar(100)') AS aller8
 FROM Split_Names

This query will work fine if we have max 8 allergens..

But it will fail to capture if we have 15 allergens.

so can somebody help to dynamically handle it.

Thanks,
Magesh

Monitor SQL-Loader Activity

$
0
0
Hi guys

I'm loading CSV files into a 10g db using SQL Loader (external table method).

The loader is only loading 40k files of size (1KB each)

Would anyone know if there is a way to monitor what the SQL Loader is actually doing because it's taking a while (been running for 20min)?

Hope I've provided enough info.

Regards
Shajju

Timers somehow when they were run.

$
0
0
Hi guys.
I ran into a problem I can't seem to solve.

Lets say I create a database that uses 10 timers. Some run every day, others run on certain days of the week, month or year.

To test if the timers are working I changed the date and time on my PC so to pretend that it's just moments before the timers are expected to run.

No problem here. Everything works find and I can see my timers have run.

However, when I set my PC back to the right time the Timers will not run. After investigating this I noticed that somehow the timers are able to remember the last date and time they have run and they won't run for me again until that date and time they last run has passed.

So my question is, does anyone know where the timers are storing this last run information and how do I clear it.

Currently the only solution I've found is to the timers and rewrite them.

Regards
James.

Missing Transmittal Report

$
0
0
Dear Seniors,

I have a Transmittal database where the list of Transmittals are entered in 1 Table.

Like
TR-3301
TR-3302
TR-3303
TR-3305
TR-3306
TR-3308

Now in the above list I have some missing Transmittals say TR-3304 & TR-3307. Is it possible to extract report which shows the missing Transmittal Numbers? I have in my database approximately 10000 Transmittals
Viewing all 13329 articles
Browse latest View live