Question: I'm looking for information about how to age data in a db, generally related to Oracle and Sql 
 Server, but any database would be good. Any examples or books containing examples of how the best 
 techniques would be cool.

Bob

Answer: 
I've made this function based on earlier answers in this post.
I share it here because some of previous examples has been thrown me segfaults

```
const char* str_repeat(char* str, size_t times)
{
    if (times < 1) return NULL;
    char *ret = malloc(sizeof(str) * times + 1);
    if (ret == NULL) return NULL;
    strcpy(ret, &str);
    while (--times > 0) {
        strcat(ret, &str);
    }
    return ret;
}

```
You may try write own function. It will be work with single-length string also (i. e. duplication a single char). It use the function "strcat()" from the "string.h", so do not forget include this header.

```
char *
str_repeat(char str[], unsigned int times)
{
    if (times < 1)
        return NULL;

    char *result;
    size_t str_len = strlen(str);
    result = malloc(sizeof(char) * str_len + 1);

    while (times--) {
        strcat(result, str);
    }
    return result;
}

```

But, if you need only duplication of a string for print it, try macro

```
#define PRINT_STR_REPEAT(str, times) \
{ \
    for (int i = 0; i < times; ++i) \
        printf("%s", str); \
    puts(""); \
}

```

Results

```
PRINT_STR_REPEAT("-", 10); // ----------
puts(str_repeat("-", 10)); // ----------

PRINT_STR_REPEAT("$", 2); // $$
puts(str_repeat("$", 2)); // $$

PRINT_STR_REPEAT("*\t*", 10); // *   **  **  **  **  **  **  **  **  **  *
puts(str_repeat("*\t*", 10));  // *   **  **  **  **  **  **  **  **  **  *

PRINT_STR_REPEAT("*_*", 10); // *_**_**_**_**_**_**_**_**_**_*
puts(str_repeat("*_*", 10)); // *_**_**_**_**_**_**_**_**_**_*

```